Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2291,13 +2291,33 @@ export default defineComponent({
return
}

// Blur player buttons to remove :focus-visible state, preventing tooltips from staying visible
const buttonWithTooltipClasses = [
'shaka-play-button',
'shaka-fullscreen-button',
'shaka-mute-button',
'shaka-pip-button',
'full-window-button',
'theatre-button',
'screenshot-button',
]
function blurTooltipButtons() {
for (const buttonClass of buttonWithTooltipClasses) {
const button = document.querySelector(`.${buttonClass}`)
if (button) {
button.blur()
}
}
}
Comment thread
Shadorc marked this conversation as resolved.

switch (event.key.toLowerCase()) {
case ' ':
case 'spacebar': // older browsers might return spacebar instead of a space character
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.PLAY:
// Toggle Play/Pause
event.preventDefault()
video_.paused ? video_.play() : video_.pause()
blurTooltipButtons()
break
case KeyboardShortcuts.VIDEO_PLAYER.PLAYBACK.LARGE_REWIND:
// Rewind by 2x the time-skip interval (in seconds)
Expand Down Expand Up @@ -2325,6 +2345,7 @@ export default defineComponent({
// Toggle full screen
event.preventDefault()
ui.getControls().toggleFullScreen()
blurTooltipButtons()
break
case KeyboardShortcuts.VIDEO_PLAYER.GENERAL.MUTE:
// Toggle mute only if metakey is not pressed
Expand All @@ -2337,6 +2358,7 @@ export default defineComponent({
const message = isMuted ? '0%' : `${Math.round(video_.volume * 100)}%`
showValueChange(message, messageIcon)
}
blurTooltipButtons()
break
case KeyboardShortcuts.VIDEO_PLAYER.GENERAL.CAPTIONS: {
// Toggle caption/subtitles
Expand Down Expand Up @@ -2401,6 +2423,7 @@ export default defineComponent({
controls.togglePiP()
}
}
blurTooltipButtons()
break
case '0':
case '1':
Expand Down Expand Up @@ -2486,6 +2509,7 @@ export default defineComponent({
events.dispatchEvent(new CustomEvent('setFullWindow', {
detail: !fullWindowEnabled.value
}))
blurTooltipButtons()
break
case KeyboardShortcuts.VIDEO_PLAYER.GENERAL.THEATRE_MODE:
// Toggle theatre mode
Expand All @@ -2496,13 +2520,15 @@ export default defineComponent({
detail: !props.useTheatreMode
}))
}
blurTooltipButtons()
break
case KeyboardShortcuts.VIDEO_PLAYER.GENERAL.TAKE_SCREENSHOT:
if (enableScreenshot.value && props.format !== 'audio') {
event.preventDefault()
// Take screenshot
takeScreenshot()
}
blurTooltipButtons()
break
}
}
Expand Down
Loading