Merge pull request #1192 from jamesoflol/more-mobile-touch-issues
Don't hide controls on focusout event
This commit is contained in:
commit
f5baff6e6b
@ -697,19 +697,16 @@ class Listeners {
|
|||||||
elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);
|
elements.controls.pressed = ['mousedown', 'touchstart'].includes(event.type);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Focus in/out on controls
|
// Show controls when they receive focus (e.g., when using keyboard tab key)
|
||||||
this.bind(elements.controls, 'focusin focusout', event => {
|
this.bind(elements.controls, 'focusin', event => {
|
||||||
const { config, elements, timers } = player;
|
const { config, elements, timers } = player;
|
||||||
const isFocusIn = event.type === 'focusin';
|
|
||||||
|
|
||||||
// Skip transition to prevent focus from scrolling the parent element
|
// Skip transition to prevent focus from scrolling the parent element
|
||||||
toggleClass(elements.controls, config.classNames.noTransition, isFocusIn);
|
toggleClass(elements.controls, config.classNames.noTransition, true);
|
||||||
|
|
||||||
// Toggle
|
// Toggle
|
||||||
ui.toggleControls.call(player, isFocusIn);
|
ui.toggleControls.call(player, true);
|
||||||
|
|
||||||
// If focusin, hide again after delay
|
|
||||||
if (isFocusIn) {
|
|
||||||
// Restore transition
|
// Restore transition
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
toggleClass(elements.controls, config.classNames.noTransition, false);
|
toggleClass(elements.controls, config.classNames.noTransition, false);
|
||||||
@ -721,9 +718,8 @@ class Listeners {
|
|||||||
// Clear timer
|
// Clear timer
|
||||||
clearTimeout(timers.controls);
|
clearTimeout(timers.controls);
|
||||||
|
|
||||||
// Hide
|
// Hide again after delay
|
||||||
timers.controls = setTimeout(() => ui.toggleControls.call(player, false), delay);
|
timers.controls = setTimeout(() => ui.toggleControls.call(player, false), delay);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Mouse wheel for volume
|
// Mouse wheel for volume
|
||||||
|
Loading…
x
Reference in New Issue
Block a user