Skip to content

Commit

Permalink
[core] Remove usage of deprecated .keyCode
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Sep 11, 2020
1 parent ad558cb commit 072c802
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
6 changes: 1 addition & 5 deletions docs/src/modules/components/AppSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,8 @@ export default function AppSearch() {

React.useEffect(() => {
const handleKeyDown = (nativeEvent) => {
// Use nativeEvent.keyCode to support IE 11
if (
[
191, // '/'
83, // 's'
].indexOf(nativeEvent.keyCode) !== -1 &&
['/', 's'].indexOf(nativeEvent.key) !== -1 &&
document.activeElement.nodeName === 'BODY' &&
document.activeElement !== inputRef.current
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,7 @@ function Unstable_TrapFocus(props) {
};

const loopFocus = (nativeEvent) => {
// 9 = Tab
if (disableEnforceFocus || !isEnabled() || nativeEvent.keyCode !== 9) {
if (disableEnforceFocus || !isEnabled() || nativeEvent.key !== 'Tab') {
return;
}

Expand Down

0 comments on commit 072c802

Please sign in to comment.