diff options
author | Sam Potts <sam@potts.es> | 2020-02-08 22:18:59 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-08 22:18:59 +0000 |
commit | f00c2793667d546e1cf3f1b6c90bc80dfa0915f7 (patch) | |
tree | d61a8830925af9bf327a56f4cc7fb16f6b75a771 /src/js/utils/elements.js | |
parent | b651d6f0272832242267992a4b3047bfcf779031 (diff) | |
parent | e17da7dfd467e5d970400a32860f6653bcc0f556 (diff) | |
download | plyr-f00c2793667d546e1cf3f1b6c90bc80dfa0915f7.tar.lz plyr-f00c2793667d546e1cf3f1b6c90bc80dfa0915f7.tar.xz plyr-f00c2793667d546e1cf3f1b6c90bc80dfa0915f7.zip |
Merge pull request #1675 from Laerdal/focus-trap-only-fullscreen
Trap keyboard focus only when fullscreen
Diffstat (limited to 'src/js/utils/elements.js')
-rw-r--r-- | src/js/utils/elements.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/js/utils/elements.js b/src/js/utils/elements.js index 4f10938e..921d533a 100644 --- a/src/js/utils/elements.js +++ b/src/js/utils/elements.js @@ -257,10 +257,11 @@ export function trapFocus(element = null, toggle = false) { const focusable = getElements.call(this, 'button:not(:disabled), input:not(:disabled), [tabindex]'); const first = focusable[0]; const last = focusable[focusable.length - 1]; + const player = this; const trap = event => { // Bail if not tab key or not fullscreen - if (event.key !== 'Tab' || event.keyCode !== 9) { + if (event.key !== 'Tab' || event.keyCode !== 9 || !player.fullscreen.active) { return; } |