Skip to content

fix: only change focus from BPB if not tap or mouse click#9015

Merged
Essk merged 2 commits intovideojs:mainfrom
Frenzie:9006-ignore-tap-for-big-play-button-focus
Apr 15, 2025
Merged

fix: only change focus from BPB if not tap or mouse click#9015
Essk merged 2 commits intovideojs:mainfrom
Frenzie:9006-ignore-tap-for-big-play-button-focus

Conversation

@Frenzie
Copy link
Copy Markdown
Contributor

@Frenzie Frenzie commented Mar 20, 2025

References #9006. Minor extension of #4497.

Specific Changes proposed

Don't set focus after tapping on the big play button

Requirements Checklist

  • Feature implemented / Bug fixed
  • If necessary, more likely in a feature request than a bug fix
    • Change has been verified in an actual browser (Chrome, Firefox, IE)
    • Unit Tests updated or fixed
    • Docs/guides updated
    • Example created (starter template on JSBin)
    • Has no DOM changes which impact accessiblilty or trigger warnings (e.g. Chrome issues tab)
    • Has no changes to JSDoc which cause npm run docs:api to error
  • Reviewed by Two Core Contributors

@welcome
Copy link
Copy Markdown

welcome Bot commented Mar 20, 2025

💖 Thanks for opening this pull request! 💖

Things that will help get your PR across the finish line:

  • Run npm run lint -- --errors locally to catch formatting errors earlier.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 22, 2025

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 84.31%. Comparing base (751ac56) to head (970abcf).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/js/big-play-button.js 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #9015      +/-   ##
==========================================
- Coverage   84.34%   84.31%   -0.04%     
==========================================
  Files         120      120              
  Lines        8152     8152              
  Branches     1964     1964              
==========================================
- Hits         6876     6873       -3     
- Misses       1276     1279       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Frenzie Frenzie changed the title Only change focus from BPB if not tap or mouse click fix: only change focus from BPB if not tap or mouse click Mar 22, 2025
@Essk Essk merged commit 76aadfe into videojs:main Apr 15, 2025
9 of 11 checks passed
@welcome
Copy link
Copy Markdown

welcome Bot commented Apr 15, 2025

Congrats on merging your first pull request! 🎉🎉🎉

@Frenzie Frenzie deleted the 9006-ignore-tap-for-big-play-button-focus branch April 15, 2025 09:59
@OwenEdwards
Copy link
Copy Markdown
Member

OwenEdwards commented Jun 16, 2025

@Frenzie and @mister-ben - where does focus go when the big play button is activated, if it doesn't move to the play/pause button in the control bar? For accessibility, it can't be left in an indeterminate state, and since the BPB is hidden when it is activated, moving focus to the other play/pause button made the most sense. I'm not clear what the expected outcome of this fix is if the user clicks or taps the BPB, but this idea of not moving focus to a control has been used in media players in the past as a workaround for the focus outline appearing on a control when some designers don't like the focus outline.

If that's what this fix is trying to achieve, then it would be much better (and more accessible) to adopt the :focus-visible approach, so that focus does move to the play/pause button but the focus outline is only shown if it is needed (by users who are using a mouse or touch). See also the https://github.com/videojs/video.js/blob/main/sandbox/noUITitleAttributes.html.example example I created 4 years ago, back when focus-visible was polyfilled.

@Frenzie
Copy link
Copy Markdown
Contributor Author

Frenzie commented Jun 16, 2025

Focus shifts to the video element.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants