Open Bug 1845864 Opened 2 years ago Updated 2 years ago

inert embedded video still responds to play/pause key

Categories

(Core :: DOM: UI Events & Focus Handling, enhancement)

Firefox 115
enhancement

Tracking

()

People

(Reporter: ataylor32, Unassigned)

Details

Attachments

(1 file)

Attached file Demo

Steps to reproduce:

(1) Open the attached HTML file
(2) Start playing the embedded YouTube video
(3) Click the "Inert" checkbox to make the embedded YouTube video's iframe inert
(4) Press the play/pause key on the keyboard

Actual results:

The video paused.

Expected results:

The video should continue playing due to the inert attribute being present on the iframe.

The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Graphics: WebRender
Product: Firefox → Core

I cant repro this bug (i.e. When I try the STR, the video continues to play).
In any case, this should not be a webrender issue. Tentatively reclassifying to DOM:UI events.

Component: Graphics: WebRender → DOM: UI Events & Focus Handling

It's reproducible, but I don't think it's a valid bug. Inert is defined in the HTML spec: https://html.spec.whatwg.org/#inert, and I suppose you could argue that since the iframe can't be focused the keys shouldn't have any effect. However the keyboard multimedia keys are a user agent feature that works a bit independently, for example if there are two videos on the page both are stopped. As such I think they're not affected by inertness.

Status: UNCONFIRMED → NEW
Ever confirmed: true

According to MDN, the inert attribute "makes the browser ignore input events sent by the user". That makes me think this is a valid bug.

I agree with peterv, Gecko has a media controller outside the DOM, and it seems that it does not check disabled nor inert. Once browsers allow web apps to disable user interaction of media elements, users cannot stop/mute unexpected media play.

Gijs and karlt: I'm not sure who handles the UI design, are you or do you know?

Flags: needinfo?(karlt)
Flags: needinfo?(gijskruitbosch+bugs)

Alastor would know more about the intended mediacontroller behavior.
I suspect "makes the browser ignore input events sent by the user" was not written considering system-level mediacontroller events, but intended to cover specific events as it goes on to list. MDN is not the definition of truth here anyway.

Flags: needinfo?(karlt) → needinfo?(alwu)

From the spec:

Content in an inert subtree will not be perceivable by all users, or interactive

Currently, users can interact with an inert video with the play/pause key on their keyboard.

Perhaps it will help if I explain my real world use case rather than using the attached demo. I have a <dialog> that I want to be able to be dismissed, but not remove the content of it because the user may reopen it. I have it set up so that when the <dialog> is dismissed, the video within it automatically pauses. But if the user presses the play/pause key on their keyboard, the video starts playing again even though the <dialog> isn't visible. I added the inert attribute to prevent this, but that didn't solve the problem.

This is an interesting issue. I'm not sure if we should exclude inert element for the media control. But more specifically, I would always want media control to be able to pause ANY playing media, but it seems ok to me that we can exclude inert element from the media control if that element has been paused.

However, from the point of the web compatibility, Chrome/Edge/Safari all have same behavior with Firefox, the element can still be controlled by media keys even if the element has been marked as inert. In addition, according to this, By default, there is no visual way to tell whether or not an element or its subtree is inert. So if we decide to support not to resume the inert element, there is no visual clue to tell users why it doesn't work.

Perhaps it will help if I explain my real world use case rather than using the attached demo. I have a <dialog> that I want to be able to be dismissed, but not remove the content of it because the user may reopen it. I have it set up so that when the <dialog> is dismissed, the video within it automatically pauses. But if the user presses the play/pause key on their keyboard, the video starts playing again even though the <dialog> isn't visible. I added the inert attribute to prevent this, but that didn't solve the problem.

If so, I would suggest you to use MediaSession: setActionHandler to set your own handler on play and pause to determine what video should be controlled.

Type: defect → enhancement
Flags: needinfo?(alwu)
Severity: -- → N/A
Flags: needinfo?(gijskruitbosch+bugs)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: