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:
12
app/utils/isTextInput.js
Normal file
12
app/utils/isTextInput.js
Normal 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")
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user