Fix: permanent player tooltip #9119
Conversation
Head branch was pushed to by a user without write access
|
I found a small edge case:
minor_edge_case.mp4 |
|
Thanks for testing, it is indeed a bug! It comes from the fact that I only clear tooltip for the button corresponding to the shortcut key, but it could be a different tooltip shown. |
Head branch was pushed to by a user without write access
Head branch was pushed to by a user without write access
edge_case.mp4the edge case is fixed from my testing |
| // Blur player buttons to remove :focus-visible state, preventing tooltips from staying visible | ||
| function blurTooltipButtons() { | ||
| const buttonWithTooltipClasses = [ | ||
| 'shaka-play-button', | ||
| 'shaka-fullscreen-button', | ||
| 'shaka-mute-button', | ||
| 'shaka-pip-button', | ||
| 'full-window-button', | ||
| 'theatre-button', | ||
| 'screenshot-button' | ||
| ] | ||
| for (const buttonClass of buttonWithTooltipClasses) { | ||
| const button = document.querySelector(`.${buttonClass}`) | ||
| if (button) { | ||
| button.blur() | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Avoid creating a new array on every call
| // Blur player buttons to remove :focus-visible state, preventing tooltips from staying visible | |
| function blurTooltipButtons() { | |
| const buttonWithTooltipClasses = [ | |
| 'shaka-play-button', | |
| 'shaka-fullscreen-button', | |
| 'shaka-mute-button', | |
| 'shaka-pip-button', | |
| 'full-window-button', | |
| 'theatre-button', | |
| 'screenshot-button' | |
| ] | |
| for (const buttonClass of buttonWithTooltipClasses) { | |
| const button = document.querySelector(`.${buttonClass}`) | |
| if (button) { | |
| button.blur() | |
| } | |
| } | |
| } | |
| // 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() | |
| } | |
| } | |
| } |
Pull Request Type
Related issue
closes #8046
Description
When hovering over a button displays a tooltip, using the button's keyboard shortcut causes the button to receive focus. According to Shaka Player's CSS rules (https://github.com/shaka-project/shaka-player/blob/main/ui/less/tooltip.less#L48), the
:focus-visiblepseudo-class keeps the tooltip visible until focus is removed.Calling blur() after a keyboard shortcut is triggered, removing focus by clearing the
:focus-visiblestate, hiding the tooltip.There is a good explanation of the issue here twbs/bootstrap#18777 (comment)
Screenshots
No visible change to show
Testing
Scenario 1
Scenario 2 (thanks aditya0155)
Desktop
Additional context