Open Bug 1502093 Opened 6 years ago Updated 2 years ago

When using a fullscreen button on a video, Focus-behavior is inconsistent across platforms

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

People

(Reporter: denschub, Unassigned)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

In bug 1490459, we received a note that the twitch video player appears to have an issue. On Windows, if you fullscreen the player using the fullscreen button and then it spacebar, the player exists out of fullscreen. On macOS, in contrast, it pauses the video, as one might expect. During diagnosis, I discovered that on macOS, the <video> element receives the focus after the button is clicked. In Windows, however, the focus stays on the <button> responsible for toggling the fullscreen, thus closing the fullscreen mode when pressing spacebar. This, however, does not appear to be an issue with Twitch. I could observe the same behavior on Vimeo, and even with the native video playback controls at https://stuff.schub.io/dummy/timestamped_dummy.mp4 for example. So, in short, STR: 1. Open https://stuff.schub.io/dummy/timestamped_dummy.mp4 2. Hit the fullscreen button 3. Press spacebar Expected: 1. Video pauses Actual, on Windows: 1. Fullscreen mode quits Filing this into General, as I don't really know where this belongs.
I don't think we have any special handling to change focus for fullscreen. What was focused should keep being focus after entering fullscreen. It seems to me that the fullscreen button on macOS isn't focusable at all, that may be the reason the handling is different.
Does mac start behaving the same if you go to the system preferences > keyboard > shortcuts, and at the bottom, set the radio button to "all controls" ? (ni: denschub for this) I don't really know what to do here. We can address this for the built-in video controls, I think, but as Xidorn said, focus should normally stay with the thing that gets focused - this is something the site can easily fix itself by just calling videoElement.focus() after calling the full screen handler. I guess we could in principle make toggling fullscreen on an element (maybe only video elements?) focus that element, but that could theoretically interfere with other things... Moving this to DOM so they can consider whether such a thing would make sense. (In reply to Xidorn Quan [:xidorn] UTC+11 from comment #2) > I don't think we have any special handling to change focus for fullscreen. > What was focused should keep being focus after entering fullscreen. Well, the justification for doing something else is that after element.mozFullscreen or whatever, any other element that might have had focus is no longer visible to the user, and so focusing the (only) thing that's visible at that point may make more sense than leaving focus with an element that is nowhere to be seen... Does the HTML spec not say anything about this? Maybe :xidorn or :enn have more ideas here.
Component: General → DOM: Core & HTML
Flags: needinfo?(xidorn+moz)
Flags: needinfo?(enndeakin)
Flags: needinfo?(dschubert)
Product: Firefox → Core
I think this is just an issue that would be fixed by 570835.
Flags: needinfo?(enndeakin)
Depends on: 570835
(In reply to :Gijs (he/him) from comment #3) > Does mac start behaving the same if you go to the system preferences > > keyboard > shortcuts, and at the bottom, set the radio button to "all > controls" ? (ni: denschub for this) No, that does not change the behavior. Pressing space bar still pauses the video, regardless of the pref.
Flags: needinfo?(dschubert)
Hm. There was also some discussion in bug 735251 that glanced past the point that our focus behavior is different on mac. At least, re-reading the comments, I don't see anything that explains why we focused the video on mac but not on Windows.
(In reply to :Gijs (he/him) from comment #3) > (In reply to Xidorn Quan [:xidorn] UTC+11 from comment #2) > > I don't think we have any special handling to change focus for fullscreen. > > What was focused should keep being focus after entering fullscreen. > > Well, the justification for doing something else is that after > element.mozFullscreen or whatever, any other element that might have had > focus is no longer visible to the user, and so focusing the (only) thing > that's visible at that point may make more sense than leaving focus with an > element that is nowhere to be seen... > > Does the HTML spec not say anything about this? Maybe :xidorn or :enn have > more ideas here. Probably not. There is a concept in HTML spec called "inert"[1] which may have this meaning. And for the case you mentioned, the related concept "blocked by a modal dialog"[2] can probably be applied to fullscreen as well (although it doesn't at this moment given its name). Implementation of the concepts are tracked in bug 921504 and bug 1200896 correspondingly. But... I don't think that would make much difference in practice, because I suspect in most of cases, the button to enter fullscreen would be in the fullscreen element, so they are still visible and interactable. If we want to fix this somehow, probably we can put the focus on the fullscreen element or just the document. That would be a web-exposed change, so it may be worth checking what other browsers do here. [1] https://html.spec.whatwg.org/multipage/interaction.html#inert [2] https://html.spec.whatwg.org/multipage/interaction.html#blocked-by-a-modal-dialog
Flags: needinfo?(xidorn+moz)
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.