summaryrefslogtreecommitdiff
path: root/apps/web/src/utils/browser.ts
diff options
context:
space:
mode:
Diffstat (limited to 'apps/web/src/utils/browser.ts')
-rw-r--r--apps/web/src/utils/browser.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/apps/web/src/utils/browser.ts b/apps/web/src/utils/browser.ts
new file mode 100644
index 00000000..2b9aa297
--- /dev/null
+++ b/apps/web/src/utils/browser.ts
@@ -0,0 +1,17 @@
+export function isTypableDOMElement({
+ element,
+}: {
+ element: HTMLElement;
+}): boolean {
+ if (element.isContentEditable) return true;
+
+ if (element.tagName === "INPUT") {
+ return !(element as HTMLInputElement).disabled;
+ }
+
+ if (element.tagName === "TEXTAREA") {
+ return !(element as HTMLTextAreaElement).disabled;
+ }
+
+ return false;
+}