NickColley / semaphore

Accessible, simple and fast web client for Mastodon
https://semaphore.social
GNU Affero General Public License v3.0
171 stars 27 forks source link

Left and right arrow keys can't be used to seek audio/video #44

Open jcsteh opened 1 year ago

jcsteh commented 1 year ago

When viewing media, the left and right arrow keys are bound to "go to next or previous". However, this makes it impossible for a keyboard user to seek (rewind/fast forward) audio or video content. I propose that if a video or audio element is focused, these keys should pass through to the audio/video control. The challenge is that this might be problematic for some users if they somehow focused the audio/video element (e.g. they clicked it) but do actually want the left/right arrow keys to go to next or previous.

Alternatively, I guess we could change the bindings for next/previous, though it's hard to know what to choose. Up/down arrow would override the volume control, which seems better but still not great. j/k are available there, but they're not intuitive to everyone.

Any thoughts?

NickColley commented 1 year ago

This feels like a bug indeed and a serious one, thank you for raising, I'll try to resolve it when I get time to do so.

faithanalog commented 1 year ago

When viewing media, the left and right arrow keys are bound to "go to next or previous". However, this makes it impossible for a keyboard user to seek (rewind/fast forward) audio or video content. I propose that if a video or audio element is focused, these keys should pass through to the audio/video control. The challenge is that this might be problematic for some users if they somehow focused the audio/video element (e.g. they clicked it) but do actually want the left/right arrow keys to go to next or previous.

Alternatively, I guess we could change the bindings for next/previous, though it's hard to know what to choose. Up/down arrow would override the volume control, which seems better but still not great. j/k are available there, but they're not intuitive to everyone.

Any thoughts?

i wonder is up/down also currently overriding the volume control, since up/down is used for scrolling through the timeline? (j/k are also used for that.)

I think that just forwarding all arrow keys into the video element when it's focused is a pretty reasonable solution because it's consistent with how browsers work normally anyway. like with any ol' video element on a random web page if you interact with it and focus it, arrow keys will be locked into it and not scroll the page anymore until you unfocus.

i think it would be confusing if it sent arrow keys into the video when you had the outer post containing the video focused though instead of the video element itself, since if you were down-arrowing through posts you would suddenly stop scrolling through posts and start controlling the video element instead