Skip to content

feat(a11y): use list-style-type instead of list-style none to avoid losing semantic role in Safari#41778

Closed
MaxLardenois wants to merge 2 commits into
twbs:mainfrom
MaxLardenois:replace-list-type
Closed

feat(a11y): use list-style-type instead of list-style none to avoid losing semantic role in Safari#41778
MaxLardenois wants to merge 2 commits into
twbs:mainfrom
MaxLardenois:replace-list-type

Conversation

@MaxLardenois

@MaxLardenois MaxLardenois commented Sep 29, 2025

Copy link
Copy Markdown
Contributor

Description

Replace list-style: none by list-style-type: ""

This is a new PR after I mistakenly closed the previous one (#41651) sorry about that

Motivation & Context

In Safari, using list-style: none will remove its semantic role of list, therefore it will not be announced by screen readers as such. One solution is to add role: list on each affected lists but that means relying on a good usage and adds unnecessary code. Another solution as explained here is to use list-style-type: "" instead, this will have the same visual effect but won't remove semantic role.

Type of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Refactoring (non-breaking change)
  • Breaking change (fix or feature that would change existing functionality)

Checklist

  • I have read the contributing guidelines
  • My code follows the code style of the project (using npm run lint)
  • My change introduces changes to the documentation
  • I have updated the documentation accordingly
  • I have added tests to cover my changes
  • All new and existing tests passed

Live previews

Related issues

@ffoodd ffoodd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! I'm also wondering if it should be enforced through declaration-property-value-disallowed-list in our Stylelint config? @julien-deramond @XhmikosR any thought?

@patrickhlauke

Copy link
Copy Markdown
Member

as much as working around Safari's "Apple knows best" approach to semantics ... this PR looks good to me

@patrickhlauke patrickhlauke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if we maybe want to add a comment on the various uses of list-style-type to make it clear why we use it rather than list-style: none or if that's a bit heavy-handed? either way...

@mdo

mdo commented Jun 19, 2026

Copy link
Copy Markdown
Member

#42526

@mdo mdo closed this Jun 19, 2026
mdo added a commit that referenced this pull request Jun 21, 2026
In Safari, "list-style: none" removes the list semantic role, so lists are
no longer announced by screen readers. Using "list-style-type: \"\"" keeps the
same visual result while preserving the list role.

Ports #41778 to v6, plus the new v6 list containers (stepper,
menu, docs search results). Summary marker removals (accordion header,
details summary) are intentionally left as "list-style: none".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Inbox

Development

Successfully merging this pull request may close these issues.

5 participants