fluid-lab / gamepad-navigator

GSoC 2020 project
Other
7 stars 10 forks source link

Using the `click` action on a `<video>` element doesn't do anything. #132

Closed duhrer closed 7 months ago

duhrer commented 9 months ago

At the moment, <video> elements without controls are not reachable using next/previous item navigation. (See #131 for more background.)

However, <video> elements with controls are reachable, but don't work with our click action. With a mouse click or keyboard (space, enter), the video starts or pauses. Using our click action on a video element with controls doesn't do anything.

Once we have an approach that resolves #131, we need to test video click separately.

duhrer commented 9 months ago

There's no way to get to the (generated) shadow root associated with a <video> element, but thankfully there are methods it provides as an HTMLMediaElement that we can use to:

  1. Check to see if the video is paused
  2. play if it's paused, pause if it isn't

Similar to <select> elements and text <input> elements, we would special-case handling of <video>a (and perhaps <audio>) elements in the click action.

We still need an approach for videos that don't enable controls by default, I'd suggest adding a user-configurable preference to control whether controls are added to all videos. Then we'd have something within the mutation observer that automatically enables controls for any videos that have them turned off.