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.
outline/app/utils/isTextInput.js

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