Skip to content

display: contents accessibility #568

@jensimmons

Description

@jensimmons

Description

The CSS rule display: contents is a useful feature that developers have wanted to use for years. But the original CSS property was not designed to fully take into consideration how browser engines could implement this in an accessible way. Because it required significant refactor of the entire accessibility system in browser engines, it's taken time to fix. In the meanwhile, using display:contents could make large chunks of content disappear for some users.

Because of the accessibility problems, the message to developers has been "yes, this is implemented everywhere, but don't use it!" Of course, not everyone gets the memo, and people are using it anyway.

Great progress has been made improving the accessibility of elements that have display:contents applied & their children. But there is still more work to do.

By including this work in Interop 2024, we can finally get all the browsers on the same interoperable, accessible implementation.

Specification

https://www.w3.org/TR/css-display-3/

Open Issues

There is one open issue: w3c/csswg-drafts#3040, which looks stale, and only open because it needs test cases.

Tests

There are tests for display: contents here, but the needed accessibility test coverage is missing. For this proposal to be part of Interop 2024, we will need to write new tests.

Current Implementations

  • Blink
  • Gecko
  • WebKit

Standards Positions

None found.

Browser bug reports

https://bugs.chromium.org/p/chromium/issues/detail?id=1366037
https://bugzilla.mozilla.org/show_bug.cgi?id=1791648

Developer discussions

https://adrianroselli.com/2018/05/display-contents-is-not-a-css-reset.html
And more from Adrian: https://adrianroselli.com/?s=display%3A+contents
https://cloudfour.com/thinks/see-no-evil-hidden-content-and-accessibility/
https://hidde.blog/more-accessible-markup-with-display-contents/
https://www.smashingmagazine.com/2019/05/display-box-generation/#display-contents

Workarounds

There is no work-around. If developers use display: contents in specific usecases, it's not accessible.

Accessibility Impact

This is all about making display: contents fully accessible.

Privacy Impact

No privacy impact.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions