chore: Remove react-keydown (#2713)

* First steps of remove react-keydown, replace with hook

* RegisterKeyDown component to aid transition away from react-keydown
This commit is contained in:
Tom Moor
2021-11-01 19:52:04 -07:00
committed by GitHub
parent 5f00e1394d
commit 57fa1305a6
11 changed files with 220 additions and 565 deletions

12
app/utils/isTextInput.js Normal file
View File

@@ -0,0 +1,12 @@
// @flow
const inputs = ["input", "select", "button", "textarea"];
// detect if node is a text input element
export default function isTextInput(element: HTMLElement): boolean {
return (
element &&
(inputs.indexOf(element.tagName.toLowerCase()) !== -1 ||
element.attributes.getNamedItem("role")?.value === "textbox" ||
element.attributes.getNamedItem("contenteditable")?.value === "true")
);
}