aboutsummaryrefslogtreecommitdiff
path: root/src/content/focuses.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/content/focuses.js')
-rw-r--r--src/content/focuses.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/content/focuses.js b/src/content/focuses.js
new file mode 100644
index 0000000..c2658b4
--- /dev/null
+++ b/src/content/focuses.js
@@ -0,0 +1,10 @@
+const focusInput = () => {
+ let inputTypes = ['email', 'number', 'search', 'tel', 'text', 'url'];
+ let inputSelector = inputTypes.map(type => `input[type=${type}]`).join(',');
+ let target = window.document.querySelector(inputSelector + ',textarea');
+ if (target) {
+ target.focus();
+ }
+};
+
+export { focusInput };