Bug 255149 - elements with CSS display:contents are not focusable
Summary: elements with CSS display:contents are not focusable
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: Safari 16
Hardware: Mac (Intel) macOS 13
: P2 Normal
Assignee: Nobody
Keywords: InRadar
Depends on:
Reported: 2023-04-07 07:09 PDT by L. David Baron
Modified: 2023-10-09 10:00 PDT (History)
10 users (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description L. David Baron 2023-04-07 07:09:56 PDT
This bug is based on the conclusion in https://github.com/w3c/csswg-drafts/issues/2632 (and was also discussed a bit in https://github.com/whatwg/html/issues/1837 ).  In WebKit, elements with display: contents are not currently focusable, but they should be.

This behavior currently matches other browsers.  However, I think this behavior is problematic because elements with display:contents are exposed to assistive technology as having their normal roles, and the contract for the meaning of accessibility roles includes support for certain role-specific keyboard interactions which often include focusability.  So I think it's important that the exposure to AT (as agreed in the CSSWG in https://github.com/w3c/csswg-drafts/issues/2355 and I believe implemented in WebKit in https://bugs.webkit.org/show_bug.cgi?id=243486 ) match the focusability, which it currently does not. 

Steps to reproduce:
 1. load https://cdpn.io/aardrian/debug/NWqbggX (taken from two of the Gecko/Chromium bugs below)
 2. press Option+Tab to cycle through buttons

Expected results: focus moves through all buttons (although perhaps no visual indication of focus on the display:contents button)

Actual results: focus skips the display:contents button

Parallel Chromium and Gecko bugs are:

I have a change to Chromium to fix this (though I haven't merged it yet, partly out of concern for whether other browsers are willing to match):
Comment 1 Radar WebKit Bug Importer 2023-04-14 07:10:15 PDT
Comment 2 Adrian Roselli 2023-10-07 13:52:46 PDT
Confirmed this bug persists in Safari 17 (macOS 14).
Comment 3 Adrian Roselli 2023-10-07 14:30:44 PDT
And confirmed the bug persists in Safari TP 180 (Safari 17.4 beta).
Comment 4 Jen Simmons 2023-10-09 09:42:07 PDT
Adrian, this is still "a bug" because the standards questions have not been settled yet. There's not agreement on how browsers should behave. That needs to be decided before any browser can conform to the decisions.
Comment 5 Adrian Roselli 2023-10-09 10:00:32 PDT
Agreed it is a bug (no quotes) and also agree that OP's request for position and standards clarity are blockers.

I encourage all browsers (and their representatives in the standards bodies) to settle this so users don't have to wait any longer.