This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
outline/app/utils/isTextInput.js
Tom Moor 57fa1305a6 chore: Remove react-keydown (#2713)
* First steps of remove react-keydown, replace with hook

* RegisterKeyDown component to aid transition away from react-keydown
2021-11-01 19:52:04 -07:00

13 lines
419 B
JavaScript

// @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")
);
}