Only focus button if menu wasn’t hidden already

This commit is contained in:
Sam Potts 2018-08-01 01:38:57 +10:00
parent c8db1e55dd
commit aaa56caa9c
5 changed files with 9 additions and 7 deletions

5
dist/plyr.js vendored
View File

@ -2427,7 +2427,8 @@ typeof navigator === "object" && (function (global, factory) {
}
// True toggle by default
var show = is.element(popup) && popup.hasAttribute('hidden');
var hidden = popup.hasAttribute('hidden');
var show = hidden;
if (is.boolean(input)) {
show = input;
@ -2468,7 +2469,7 @@ typeof navigator === "object" && (function (global, factory) {
setFocus.call(this, firstItem, true);
}
// If closing, re-focus the button
else if (!show) {
else if (!show && !hidden) {
setFocus.call(this, button, is.keyboardEvent(input));
}
},

2
dist/plyr.js.map vendored

File diff suppressed because one or more lines are too long

2
dist/plyr.min.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

5
src/js/controls.js vendored
View File

@ -1085,7 +1085,8 @@ const controls = {
}
// True toggle by default
let show = is.element(popup) && popup.hasAttribute('hidden');
const hidden = popup.hasAttribute('hidden');
let show = hidden;
if (is.boolean(input)) {
show = input;
@ -1124,7 +1125,7 @@ const controls = {
setFocus.call(this, firstItem, true);
}
// If closing, re-focus the button
else if (!show) {
else if (!show && !hidden) {
setFocus.call(this, button, is.keyboardEvent(input));
}
},