Skip to content

Accessibility: improve behavior of list items #4626

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

Merged
merged 4 commits into from
Apr 24, 2025
Merged

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Apr 23, 2025

Content

Improve accessibility for ListItem.

One example, when long press on a room and select the "Favorite" item, so in this screen:

image

The current read text is:

Favorite favorite double tap to activate

so quite wrong and do not give the state of the switch. With this changes, if the switch is on, the read text is:

on favorite switch, double tap to toggle

and if the switch if off, the read text is:

off favorite switch, double tap to toggle

and the switch itself is not focusable, so the next focusable item is the "Settings" item.

Remove callback duplication, that can lead to screen reader focused on the switch itself, which has no added value if the behavior is the same.

Motivation and context

Improve accessibility.

Replacement for #4047

Screenshots / GIFs

Tests

  • Enable screen reader and check the behavior of the List items used in bottom sheet, settings...

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

  • Changes have been tested on an Android device or Android emulator with API 24
  • UI change has been tested on both light and dark themes
  • Accessibility has been taken into account. See https://github.com/element-hq/element-x-android/blob/develop/CONTRIBUTING.md#accessibility
  • Pull request is based on the develop branch
  • Pull request title will be used in the release note, it clearly define what will change for the user
  • Pull request includes screenshots or videos if containing UI changes
  • You've made a self review of your PR

@bmarty bmarty added the PR-Bugfix For bug fix label Apr 23, 2025
@bmarty bmarty requested a review from a team as a code owner April 23, 2025 08:56
@bmarty bmarty requested review from ganfra and removed request for a team April 23, 2025 08:56
@bmarty bmarty changed the title Feature/bma/a11y list item Accessibility: improve behavior of list items Apr 23, 2025
Copy link
Contributor

github-actions bot commented Apr 23, 2025

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/jb2fJ9

@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Apr 23, 2025
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Apr 23, 2025
Copy link
Member Author

Choose a reason for hiding this comment

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

Waiting for a design decision about this change:

image

(asked in https://www.figma.com/design/7TqjqdMBaPpm3IavKsMYu6?node-id=5235-51684&m=dev#1228513902)

@bmarty
Copy link
Member Author

bmarty commented Apr 23, 2025

This is breaking click on ListItem, needs to push a fix.

Remove duplication of onChange. As per the documentation, it has to be used only if the behavior is different than the onClick listener of the list item.
It also has the effect to read twice the action when the screen reader is one. See #4047 (comment) for more details

a11y: remove contentDescription on List item icon, else the text is read twice.
@bmarty bmarty force-pushed the feature/bma/a11yListItem branch from 39889cb to 614e12b Compare April 23, 2025 14:40
@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Apr 23, 2025
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Apr 23, 2025
@bmarty bmarty force-pushed the feature/bma/a11yListItem branch from fe78d99 to ecc7944 Compare April 23, 2025 15:12
@bmarty bmarty added the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Apr 23, 2025
@github-actions github-actions bot removed the Record-Screenshots Runs the 'Record Screenshots' CI job and adds a commit with any new screenshots found. label Apr 23, 2025
@bmarty bmarty removed the X-Blocked label Apr 23, 2025
Copy link

codecov bot commented Apr 23, 2025

Codecov Report

Attention: Patch coverage is 89.65517% with 6 lines in your changes missing coverage. Please review.

Project coverage is 80.01%. Comparing base (4e0d00d) to head (a65d6f7).
Report is 13 commits behind head on develop.

Files with missing lines Patch % Lines
...ndroid/features/poll/impl/create/CreatePollView.kt 25.00% 3 Missing ⚠️
...ibraries/designsystem/theme/components/ListItem.kt 91.42% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #4626   +/-   ##
========================================
  Coverage    80.01%   80.01%           
========================================
  Files         2103     2103           
  Lines        55786    55815   +29     
  Branches      6939     6957   +18     
========================================
+ Hits         44638    44663   +25     
- Misses        8755     8757    +2     
- Partials      2393     2395    +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

onClick = {
state.eventSink(
CreatePollEvents.SetPollKind(
if (state.pollKind == PollKind.Disclosed) PollKind.Undisclosed else PollKind.Disclosed
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be better to let the Presenter handle this, but as it's not new, feel free to ignore.

@bmarty bmarty merged commit 2ca5419 into develop Apr 24, 2025
31 checks passed
@bmarty bmarty deleted the feature/bma/a11yListItem branch April 24, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants