File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
packages/react-devtools-shared/src/devtools/views Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ export default function SearchInput({
6464 const handleKeyDown = ( event : KeyboardEvent ) => {
6565 const { key, metaKey} = event ;
6666 if ( key === 'f' && metaKey ) {
67- if ( inputRef . current !== null ) {
68- inputRef . current . focus ( ) ;
67+ const inputElement = inputRef . current ;
68+ if ( inputElement !== null ) {
69+ inputElement . focus ( ) ;
6970 event . preventDefault ( ) ;
7071 event . stopPropagation ( ) ;
7172 }
@@ -75,10 +76,10 @@ export default function SearchInput({
7576 // It's important to listen to the ownerDocument to support the browser extension.
7677 // Here we use portals to render individual tabs (e.g. Profiler),
7778 // and the root document might belong to a different window.
78- const ownerDocument = inputRef . current . ownerDocument ;
79- ownerDocument . addEventListener ( 'keydown' , handleKeyDown ) ;
79+ const ownerDocumentElement = inputRef . current . ownerDocument . documentElement ;
80+ ownerDocumentElement . addEventListener ( 'keydown' , handleKeyDown ) ;
8081
81- return ( ) => ownerDocument . removeEventListener ( 'keydown' , handleKeyDown ) ;
82+ return ( ) => ownerDocumentElement . removeEventListener ( 'keydown' , handleKeyDown ) ;
8283 } , [ ] ) ;
8384
8485 return (
You can’t perform that action at this time.
0 commit comments