Bail out of focus trap if fullscreen is not active

- detailed in https://github.com/sampotts/plyr/issues/1665
This commit is contained in:
Kimberley Jensen 2020-02-07 15:00:04 +01:00
parent 8b9521d5a5
commit e17da7dfd4

View File

@ -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;
}