diff --git a/src/devtools/views/Components/Element.js b/src/devtools/views/Components/Element.js index 1d3ac200a9..6bc9bfeb7e 100644 --- a/src/devtools/views/Components/Element.js +++ b/src/devtools/views/Components/Element.js @@ -44,7 +44,7 @@ export default function ElementView({ data, index, style }: Props) { const { lastScrolledIDRef, treeFocused, - isUsingKeyboardOrSearch, + isNavigatingWithKeyboard, onElementMouseEnter, } = data; const id = element === null ? null : element.id; @@ -122,7 +122,7 @@ export default function ElementView({ data, index, style }: Props) { className = treeFocused ? styles.SelectedElement : styles.InactiveSelectedElement; - } else if (isHovered && !isUsingKeyboardOrSearch) { + } else if (isHovered && !isNavigatingWithKeyboard) { className = styles.HoveredElement; } diff --git a/src/devtools/views/Components/SearchInput.js b/src/devtools/views/Components/SearchInput.js index dc4069e384..e609cfa7b2 100644 --- a/src/devtools/views/Components/SearchInput.js +++ b/src/devtools/views/Components/SearchInput.js @@ -8,12 +8,9 @@ import Icon from '../Icon'; import styles from './SearchInput.css'; -type Props = {| - onSearchInteraction: () => void, -|}; +type Props = {||}; export default function SearchInput(props: Props) { - const { onSearchInteraction } = props; const { goToNextSearchResult, goToPreviousSearchResult, @@ -28,17 +25,10 @@ export default function SearchInput(props: Props) { const inputRef = useRef(null); const handleTextChange = useCallback( - ({ currentTarget }) => { - setSearchText(currentTarget.value); - onSearchInteraction(); - }, - [setSearchText, onSearchInteraction] + ({ currentTarget }) => setSearchText(currentTarget.value), + [setSearchText] ); - - const resetSearch = useCallback(() => { - setSearchText(''); - onSearchInteraction(); - }, [setSearchText, onSearchInteraction]); + const resetSearch = useCallback(() => setSearchText(''), [setSearchText]); const handleKeyDown = useCallback( event => { @@ -46,29 +36,26 @@ export default function SearchInput(props: Props) { switch (event.key) { case 'ArrowDown': selectNextElementInTree(); - onSearchInteraction(); event.preventDefault(); break; case 'ArrowUp': selectPreviousElementInTree(); - onSearchInteraction(); event.preventDefault(); break; default: break; } }, - [selectNextElementInTree, selectPreviousElementInTree, onSearchInteraction] + [selectNextElementInTree, selectPreviousElementInTree] ); const handleInputKeyPress = useCallback( ({ key }) => { if (key === 'Enter') { goToNextSearchResult(); - onSearchInteraction(); } }, - [goToNextSearchResult, onSearchInteraction] + [goToNextSearchResult] ); // Auto-focus search input @@ -119,10 +106,7 @@ export default function SearchInput(props: Props) {