Skip to content

fix: improve ListItem accessibility for title and description #4674

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

danieledument
Copy link

Motivation

The current implementation of ListItem doesn't properly handle React components passed as title/description props in terms of accessibility. The title and description should be grouped for screen readers and other assistive technologies.

Related issue

This PR improves accessibility handling in ListItem components by ensuring that React components passed as title and description props maintain their accessibility relation to each other through grouping. This is particularly important for screen readers and other assistive technologies.

Test plan

  1. Tested by passing React components as title and description props to ListItem
  2. Verified that the components maintain their accessibility properties
  3. Updated and verified snapshots for:
    • ListItem
    • ListAccordion
    • ListSection

All tests are passing, including the updated snapshot tests.

Example usage:
Same as before.

@callstack-bot
Copy link

Hey @danieledument, thank you for your pull request 🤗. The documentation from this branch can be viewed here.

@BogiKay BogiKay self-requested a review April 15, 2025 07:41
@danieledument
Copy link
Author

@BogiKay I've realized that perhaps this addition is not what we'd want from an accessibility perspective. My issue was that the text rendered in renderTitle() and renderDescription(), was read as "disabled" by the screen reader due to the selectable: false property. Wrapping them in the accessible={true} property removed this readout.

It makes no sense to me that a screen reader would interpret a text component as non-selectable when that's how it is in most cases. Instead it should opt to tell the user that it is selectable whenever that's the case. I think this PR should probably be closed. Sorry if I wasted your time.

@danieledument danieledument deleted the fix/list-item-make-title-and-description-accessible branch April 16, 2025 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants