diff --git a/desktop-app/src/renderer/components/ToolBar/AddressBar/index.tsx b/desktop-app/src/renderer/components/ToolBar/AddressBar/index.tsx index 8ac801144..703c18639 100644 --- a/desktop-app/src/renderer/components/ToolBar/AddressBar/index.tsx +++ b/desktop-app/src/renderer/components/ToolBar/AddressBar/index.tsx @@ -74,7 +74,7 @@ const AddressBar = () => { } newAddress = protocol + typedAddress; } - + if (url && url !== typedAddress) setTypedAddress(url); dispatch(setAddress(newAddress)); }, [dispatch, typedAddress] @@ -131,9 +131,15 @@ const AddressBar = () => { setPermissionRequest(null); }; - const handleKeyDown: KeyboardEventHandler = () => { - if (!isSuggesting) { + const handleKeyDown: KeyboardEventHandler = ( + e: React.KeyboardEvent + ) => { + if (!isSuggesting && !['Escape', 'Enter'].includes(e.key)) { setIsSuggesting(true); + } else if (e.key === 'Escape' && isSuggesting) { + setIsSuggesting(false); + } else if (e.key === 'Enter' && !isSuggesting) { + dispatchAddress(typedAddress); } };