-
Notifications
You must be signed in to change notification settings - Fork 7.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: focus play toggle from Big Play Btn on play #4018
Conversation
If the control bar and playtoggle exist, focus the playtoggle after triggering play via the keyboard from the Big Play Button. If `play()` returns a promise, wait until it resolves to focus, otherwise, use a setTimeout. Fixes #2729
src/js/big-play-button.js
Outdated
const playToggle = cb && cb.getChild('playToggle'); | ||
|
||
if (!playToggle) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there isn't a playToggle control, focus ought to move to either the player's <div>
, or the <video>
element, rather than just falling into a black hole! I guess the <video>
element won't be there if the player uses a Flash tech, so the <div>
makes sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can focus on the tech.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Strictly, focus ought to move to something which is actionable, but it can move to something which isn't if pressing Tab from there will get the user to an actionable control (rather than, for example, the next focusable element after the video.js player)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I'll just focus the player element and we can always tweak it in the future if we think there's something better.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to focus on the player element in this case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
If the control bar and playtoggle exist, focus the playtoggle after triggering play via the keyboard from the Big Play Button. If the control bar isn't available, then focus the player element. If play() returns a promise, wait until it resolves to focus, otherwise, use a setTimeout. Fixes #2729
@OwenEdwards @richardbushell ported over in #4132 |
@gkatsev Terrific, thanks... |
If the control bar and playtoggle exist, focus the playtoggle after
triggering play via the keyboard from the Big Play Button.
If
play()
returns a promise, wait until it resolves to focus,otherwise, use a setTimeout.
Fixes #2729