aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSam Potts <sam@potts.es>2020-02-08 22:18:59 +0000
committerGitHub <noreply@github.com>2020-02-08 22:18:59 +0000
commitf00c2793667d546e1cf3f1b6c90bc80dfa0915f7 (patch)
treed61a8830925af9bf327a56f4cc7fb16f6b75a771 /src
parentb651d6f0272832242267992a4b3047bfcf779031 (diff)
parente17da7dfd467e5d970400a32860f6653bcc0f556 (diff)
downloadplyr-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')
-rw-r--r--src/js/utils/elements.js3
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;
}