Replies: 4 comments 5 replies
-
I'm glad we're thinking about this. The space bar to play at least feels pretty common and expected, and opens the question of how this is achieved in the media chrome world. After a quick pass on youtube/vimeo/netflix, it does look like there's similar behavior but far from strictly standardized. Is there world where controls just stopPropagation on the keyboard events they want to handle and media-controller catches everything else? Do native input elements already do that? I'm not remembering some of the details of keyboard event handling, like do those events fire on the element in focus first or always fire from the window?
|
Beta Was this translation helpful? Give feedback.
-
I like the general approach here. I think one other criterion we should explicitly call out is that we don't want to break VoiceOver/other SR keyboard functionality. This is one of the places where some players opt for requiring SR users to rely on their built in keyboard shortcuts, but this creates both discoverability friction and an unnecessary learning burden that isn't being put on sighted folks. |
Beta Was this translation helpful? Give feedback.
-
Also, it seems like special handling for a wrapper element probably isn't necessary considering #263. At least in the case of Mux Player it seems to work as expected. We will need a follow-up to figure out how to handle this for the separate media-controller usecase (one potential solution to that is only allow it via global keyboard shortcuts support). |
Beta Was this translation helpful? Give feedback.
-
An additional thing we should think about is now that we have keyboard shortcuts for seeking via the left and right arrow keys, we potentially want to make this configurable on the media-controller. However, we also have the seek buttons, which are each configurable separately.
|
Beta Was this translation helpful? Give feedback.
-
Criteria:
keyup
events that bubble up to it and handle the event appropriatelyKeyboard Shortcuts are an important accessibility feature that enables often-used functionality to be quickly available. In addition, since, media-chrome/things built with it are unlikely to be full page apps themselves, these shortcuts should only function when focus is inside the player, perhaps with an option to enable it to be on the entire page as well.
Currently, the keyboard functionality in media-chrome requires being focused on a particular button and then Enter or Space keys will let you interact with the button, in addition to any native behavior that's available (for example, the sliders automatically let the arrow keys change the current time). Ideally, the keyboard shortcuts will work no matter on where the focus is, assuming that the focused button doesn't have functionality for that button already. The biggest example of that is that the space key should toggle playback when just focused on the player itself, but when focused on a particular button, it should toggle the button instead.
Additionally, the media-controller element may itself be wrapped in a separate element that represents the "player", so we want to be able to handle the keyboard shortcuts on that element as well.
Options:
I think that option 3 would be the best to implement Since we want the event delegation to happen based on the DOM structure and not based on the inheritance of the elements in the source. Though, I'm not currently sure how it'll behave in the react builds. I think I would lean towards 3.i because then each button or input doesn't necessarily need to make sure that
stopPropagation
is properly called depending on which buttons were pressed.I don't have a good idea for how to add keyboard handling to a wrapper element, but I see a few potential solutions currently:
media-controller
element (this would require cloning the KeyboardEvent, as you can't redispatch these events directly).The benefit of 1 is that it's probably less code for users of media-chrome, but 2 and 3 will also help with a standalone control bar, which 1 doesn't help with.
Here's Youtube's keyboard shortcuts (openable via
?
(shift-/
)) for inspiration of specific key to use)
Beta Was this translation helpful? Give feedback.
All reactions