diff options
author | Shin'ya Ueoka <ueokande@i-beam.org> | 2020-05-02 17:25:56 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-02 17:25:56 +0900 |
commit | 5df0537bcf65a341e79852b1b30379c73318529c (patch) | |
tree | aee5efe52412855f620cb514a13a2c14373f27b7 /src/content/presenters/FocusPresenter.ts | |
parent | 685f2b7b69218b06b5bb676069e35f79c5048c9b (diff) | |
parent | 75abd90ecb8201ad845b266f96220d8adfe19b2d (diff) |
Merge pull request #749 from ueokande/qa-0.28
QA 0.28
Diffstat (limited to 'src/content/presenters/FocusPresenter.ts')
-rw-r--r-- | src/content/presenters/FocusPresenter.ts | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/content/presenters/FocusPresenter.ts b/src/content/presenters/FocusPresenter.ts index 842c41e..4d70a6e 100644 --- a/src/content/presenters/FocusPresenter.ts +++ b/src/content/presenters/FocusPresenter.ts @@ -1,4 +1,4 @@ -import * as doms from '../../shared/utils/dom'; +import * as doms from "../../shared/utils/dom"; export default interface FocusPresenter { focusFirstElement(): boolean; @@ -6,9 +6,13 @@ export default interface FocusPresenter { export class FocusPresenterImpl implements FocusPresenter { focusFirstElement(): boolean { - const inputTypes = ['email', 'number', 'search', 'tel', 'text', 'url']; - const inputSelector = inputTypes.map(type => `input[type=${type}]`).join(','); - const targets = window.document.querySelectorAll(inputSelector + ',textarea'); + const inputTypes = ["email", "number", "search", "tel", "text", "url"]; + const inputSelector = inputTypes + .map((type) => `input[type=${type}]`) + .join(","); + const targets = window.document.querySelectorAll( + inputSelector + ",textarea" + ); const target = Array.from(targets).find(doms.isVisible); if (target instanceof HTMLInputElement) { target.focus(); @@ -20,4 +24,3 @@ export class FocusPresenterImpl implements FocusPresenter { return false; } } - |