Open Bug 1744078 Opened 4 years ago Updated 4 years ago

KeyboardEvent.ctrlKey prevents Audio Autoplay unlock? (also other modifier keys)

Categories

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

Firefox 94
defect

Tracking

()

UNCONFIRMED

People

(Reporter: github, Unassigned)

Details

Attachments

(1 file)

Attached file index.html

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:94.0) Gecko/20100101 Firefox/94.0

Steps to reproduce:

Consider a simple, keyboard controlled audio player: an <audio> element, some JS to listen on keydown and trigger .play().
Since the keydown is user interaction (like a click), this should get around Autoplay blocking, and start playback.

Actual results:

It works as long as I don't use modifier keys: event.key === '#' works, but event.key === '#' && event.ctrlKey does not -- the Block Audio icon pops up in the URL bar. Only happens on https (and file://), not on http.

See attached file to reproduce, or this pen. Note: serve the html via https. In the pen, you might need to right-click & "open frame in new window". Avoid extra clicks since they unlock audio (I think).
Press Space or # to play -- this should start playback;
press Ctrl+Space or Alt+# -- Blocked Audio icon should appear, no playback.

Expected results:

I'd expect keydown events to unlock Audio, regardless of modifier keys.

The Bugbug bot thinks this bug should belong to the 'Core::DOM: UI Events & Focus Handling' component, and is moving the bug to that component. Please revert this change in case you think the bot is wrong.

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core

S3, because a workaround (not using a modifier) exists.

Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: