Allow keyboard access to volume level from volume-menu-button
Description
In the current version of VideoJS, a user has to tab from the Volume/Mute Toggle button to the volume bar to change the volume using the keyboard. Only when on the volumeBar/slider will up-arrow/down-arrow change the volume using the keyboard.
I am proposing allowing the volume level to be changed from the volume/mute toggle button so that user's can avoid having to tab a second time. The volume/mute toggle would still handle ENTER/SPACE to mute/toggle but user's could also use UP-ARROW/DOWN-ARROW to step the volume up or down respectively. Visually this also makes sense, since tabbing to the mute/toggle button shows the volumeBar.
The proposed change would be to add a handleKeyPress method to volume-menu-button.js to handle stepping the volume up or down.
Include a reduced test case, we have a starter template on JSBin you can use.
Steps to reproduce
More of an enhancement request than an issue.
- Tab to the volume/mute toggle button
- Press up or down arrow
Results
Expected
Volume changes
Actual
Volume doesn't change
Error output
N/A
Additional Information
Please include any additional information necessary here. Including the following:
versions
videojs
what version of videojs does this occur with?
browsers
what browser are affected?
OSes
what platforms (operating systems and devices) are affected?
plugins
are any videojs plugins being used on the page? If so, please list them below.
Yeah, sounds like it would be useful to have.
We need to think about this in relation to how the V6 combined volume control ought to work, so that we're working in that direction. I agree that it ought to be a single Tab stop which can perform mute toggle and volume control, but it also needs to announce its role (e.g. combined volume control and mute toggle) and value (muted, 25%, 100% etc) to screen readers correctly.
Looking back at this, I think it ought to be possible with the changes coming in #5571.
One idea that came up was whether we want to mirror this into the volume slider control, so that a 'click', 'Enter' or 'Space' on that control effectively clicks the Mute button? This seems somewhat reasonable since click/Enter/Space on the progress bar is effectively mapped to click the Play/Pause button.
(But it might lead to some people wondering why the mute button and the volume slider are separate tab stops at all. I can't think of an elegant way to handle having them as a single composite control for Screen Readers though. That might need more thought.)
Any thoughts about this idea though, @gkatsev and @marguinbc
Thanks for opening this and for building with Video.js. For the last year we’ve been hard at work re-building the player from the ground up for the modern web. It’s now available as v10 and we’d love for you to join us by upgrading. If you still have this request for version 10, please open a new issue or discussion and link back here.
Otherwise, Video.js v8 will continue to be maintained in videojs/videojs-v8 as best as we can and will get security fixes until October 1, 2028 (see its security policy). It will no longer get new features, and we're closing v8 feature requests.
Moving to Video.js 10? Use a migration guide: HTML · React.
Migrating with a coding agent? Paste the prompt from the guide's AI Quickstart section into your agent: HTML · React.
If this is a security vulnerability, don't add details here. Report it privately through private vulnerability reporting.