-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ADA-28): [V7-Acc] Make sure focus returns to the fuction opening …
…button upon modal closure. (#824) focus should return to settings button after close the modal by keyboard solves ADA-28
- Loading branch information
1 parent
628049f
commit f162134
Showing
3 changed files
with
48 additions
and
4 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// @flow | ||
/** | ||
* focus element | ||
* | ||
* @export | ||
* @param {HTMLElement} element - reference element | ||
* @param {number} delay - delay number default 100 | ||
* @returns {void} | ||
*/ | ||
export function focusElement(element: HTMLElement | null, delay: number = 100): void { | ||
const interval = setInterval(() => { | ||
if (element && getComputedStyle(element).visibility !== 'hidden') { | ||
element.focus(); | ||
clearInterval(interval); | ||
} | ||
}, delay); | ||
} |