Open Bug 1893245 Opened 1 year ago Updated 1 year ago

Keyboard event not delivered when body has display:contents style

Categories

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

Firefox 125
defect

Tracking

()

UNCONFIRMED

People

(Reporter: leesongun, Unassigned)

Details

Attachments

(1 file)

Steps to reproduce:

The following is a minimal working example:

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
  </head>
  <body style="display:contents" onkeydown="console.log('hello')">
  </body>
</html>

Actual results:

Keyboard event is not dispatched.

Expected results:

It should print "hello" on console.

Summary: keyboard events ignored when `display:content` applied to `body` → Keyboard event not delivered when body has display:contents style

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 correct in case you think the bot is wrong.

Component: Untriaged → DOM: UI Events & Focus Handling
Product: Firefox → Core
Attached file test.html

The key event is dropped in content process in https://searchfox.org/mozilla-central/rev/b41bb321fe4bd7d03926083698ac498ebec0accf/layout/base/PresShell.cpp#8258-8262; the focused element is <body> and it has no frame (because it is display:contents), so we forward it to parent presshell, but there is no parent presshell.

I think this behavior has been around for a long time.

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

Attachment

General

Created:
Updated:
Size: