Types src/content
This commit is contained in:
parent
992b3ac65d
commit
d01db82c0d
62 changed files with 1411 additions and 468 deletions
|
@ -1,11 +1,13 @@
|
|||
import * as doms from 'shared/utils/dom';
|
||||
import * as doms from '../shared/utils/dom';
|
||||
|
||||
const focusInput = () => {
|
||||
const focusInput = (): void => {
|
||||
let inputTypes = ['email', 'number', 'search', 'tel', 'text', 'url'];
|
||||
let inputSelector = inputTypes.map(type => `input[type=${type}]`).join(',');
|
||||
let targets = window.document.querySelectorAll(inputSelector + ',textarea');
|
||||
let target = Array.from(targets).find(doms.isVisible);
|
||||
if (target) {
|
||||
if (target instanceof HTMLInputElement) {
|
||||
target.focus();
|
||||
} else if (target instanceof HTMLTextAreaElement) {
|
||||
target.focus();
|
||||
}
|
||||
};
|
||||
|
|
Reference in a new issue