-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to turn on autofocus (#200)
* upgrade airgap.js types * upgrade airgap.js types to right version... * add autofocus + fix-ish eslint * bump package version
- Loading branch information
1 parent
0334a95
commit 8379d69
Showing
11 changed files
with
31 additions
and
17 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file renamed
BIN
+135 KB
...ypes-npm-12.3.0-9a211835fa-f7a834296e.zip → ...ypes-npm-12.6.0-6d4470c14e-4d22a5b1b7.zip
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,12 +77,15 @@ export function Main({ | |
const dialogRef = useRef<HTMLDivElement>(null); | ||
useEffect(() => { | ||
if (!isViewStateClosed(viewState) && dialogRef.current) { | ||
const shouldAutofocus = config.autofocus ?? true; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
eligrey
Member
|
||
// This setTimeout was necessary for the api triggered states, (DoNotSell|OptOut)Disclosure | ||
setTimeout(() => { | ||
if (dialogRef.current) initialFocusElement(dialogRef.current); | ||
if (dialogRef.current && shouldAutofocus) { | ||
initialFocusElement(dialogRef.current); | ||
} | ||
}, 0); | ||
} | ||
}, [viewState, dialogRef]); | ||
}, [viewState, dialogRef, config.autofocus]); | ||
|
||
// Modal open views | ||
if (!isViewStateClosed(viewState)) { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@linh-transcend I think we should explicitly look for
=== 'on'
or!== 'off'
. The way it's currently implemented, the only way to disable autofocus is withdata-autofocus=""
which feels a bit awkward