File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
packages/react-devtools-shared/src/devtools/views/Components Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,7 @@ export default function EditableValue({
5151
5252 switch ( event . key ) {
5353 case 'Enter' :
54- if ( isValid && hasPendingChanges ) {
55- overrideValueFn ( path , parsedValue ) ;
56- }
54+ applyChanges ( ) ;
5755 break ;
5856 case 'Escape' :
5957 reset ( ) ;
@@ -63,6 +61,17 @@ export default function EditableValue({
6361 }
6462 } ;
6563
64+ const handleBlur = event => {
65+ event . stopPropagation ( ) ;
66+ applyChanges ( ) ;
67+ } ;
68+
69+ const applyChanges = ( ) => {
70+ if ( isValid && hasPendingChanges ) {
71+ overrideValueFn ( path , parsedValue ) ;
72+ }
73+ } ;
74+
6675 let placeholder = '' ;
6776 if ( editableValue === undefined ) {
6877 placeholder = '(undefined)' ;
@@ -77,6 +86,7 @@ export default function EditableValue({
7786 className = { `${ isValid ? styles . Input : styles . Invalid } ${ className } ` }
7887 onChange = { handleChange }
7988 onKeyDown = { handleKeyDown }
89+ onBlur = { handleBlur }
8090 placeholder = { placeholder }
8191 ref = { inputRef }
8292 type = "text"
You can’t perform that action at this time.
0 commit comments