diff options
Diffstat (limited to 'src/features/webControls/components/WebControls.tsx')
-rw-r--r-- | src/features/webControls/components/WebControls.tsx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/features/webControls/components/WebControls.tsx b/src/features/webControls/components/WebControls.tsx index aee568a7d..25b23cbee 100644 --- a/src/features/webControls/components/WebControls.tsx +++ b/src/features/webControls/components/WebControls.tsx | |||
@@ -15,6 +15,7 @@ import { | |||
15 | import withStyles, { type WithStylesProps } from 'react-jss'; | 15 | import withStyles, { type WithStylesProps } from 'react-jss'; |
16 | import { Tooltip as ReactTooltip } from 'react-tooltip'; | 16 | import { Tooltip as ReactTooltip } from 'react-tooltip'; |
17 | import Icon from '../../../components/ui/icon'; | 17 | import Icon from '../../../components/ui/icon'; |
18 | import { isEnterKeyPress, isEscapeKeyPress } from '../../../jsUtils'; | ||
18 | 19 | ||
19 | const messages = defineMessages({ | 20 | const messages = defineMessages({ |
20 | goHome: { | 21 | goHome: { |
@@ -215,7 +216,7 @@ class WebControls extends Component<IProps, IState> { | |||
215 | }); | 216 | }); |
216 | }} | 217 | }} |
217 | onKeyDown={event => { | 218 | onKeyDown={event => { |
218 | if (event.key === 'Enter') { | 219 | if (isEnterKeyPress(event.key)) { |
219 | this.setState({ | 220 | this.setState({ |
220 | editUrl: false, | 221 | editUrl: false, |
221 | }); | 222 | }); |
@@ -224,7 +225,7 @@ class WebControls extends Component<IProps, IState> { | |||
224 | if (this.inputRef?.current) { | 225 | if (this.inputRef?.current) { |
225 | this.inputRef.current.blur(); | 226 | this.inputRef.current.blur(); |
226 | } | 227 | } |
227 | } else if (event.key === 'Escape') { | 228 | } else if (isEscapeKeyPress(event.key)) { |
228 | this.setState({ | 229 | this.setState({ |
229 | editUrl: false, | 230 | editUrl: false, |
230 | inputUrl: url, | 231 | inputUrl: url, |