-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Fix VoiceOver does not announce state of ButtonSegment #175635
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
Fix VoiceOver does not announce state of ButtonSegment #175635
Conversation
0ce17cb to
e105cdd
Compare
|
Google testing failures are legitimate. The tests print semantics that match the checked/unchecked states which this PR changes to the selected state. |
chunhtai
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: huycozy <[email protected]>
e105cdd to
5d44147
Compare
|
autosubmit label was removed for flutter/flutter/175635, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label. |
|
@chunhtai I fetched the latest code and rebased for this pr, but Google test is still failing. Perhaps need to update them, too? (maybe some tests there rely on |
|
@chunhtai or @victorsanni would one of you be able to take on shepherding this through the Google testing failures? (Thank you in advance 🙏 ) |
Google testing failures are semantics goldens, same as above. I will liaise with @chunhtai to apply google fixes to unblock this PR. |
|
autosubmit label was removed for flutter/flutter/175635, because The base commit of the PR is older than 7 days and can not be merged. Please merge the latest changes from the main into this branch and resubmit the PR. |
- Fix flutter#146987 - As explained at flutter#146987 (comment): this PR proposes _replacing_ `checked` with `selected` here: https://github.com/flutter/flutter/blob/f4de70c6470386db28d23ac5e2e48c681ca23c7a/packages/flutter/lib/src/material/segmented_button.dart#L634 Then VoiceOver can indicate when the button segment is selected. It's _replacing_ action but not _adding_ because _adding_ (keep both `checked` and `selected`) will cause the button to be read with both checked and selected states with Android TalkBack reader that may cause confusion to users (watch demo videos). I also did test with iOS segmented control (storyboard) and Android Jetpack Compose to compare: on these native platforms, it announces `selected` state (watch demo videos). <details> <summary>Demo Flutter app - after the fix</summary> | Flutter Android | Flutter iOS | | --------------- | --------------- | <video src="https://github.com/user-attachments/assets/458c9b78-8275-45db-83cb-b2581505d240"/> | <video src="https://github.com/user-attachments/assets/1c69694d-67f8-4f8c-a453-2cf7696e43b5"/> </details> <details> <summary>Demo native platforms</summary> | Android Jetpack Compose | iOS segmented control (storyboard) | | --------------- | --------------- | <video src="https://github.com/user-attachments/assets/5b682c7e-4c50-49be-a613-58673154aa88"/> | <video src="https://github.com/user-attachments/assets/9faba9ea-d373-4756-953a-cde510871247"/> </details> ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Signed-off-by: huycozy <[email protected]> Co-authored-by: Victor Sanni <[email protected]>
- Fix flutter#146987 - As explained at flutter#146987 (comment): this PR proposes _replacing_ `checked` with `selected` here: https://github.com/flutter/flutter/blob/f4de70c6470386db28d23ac5e2e48c681ca23c7a/packages/flutter/lib/src/material/segmented_button.dart#L634 Then VoiceOver can indicate when the button segment is selected. It's _replacing_ action but not _adding_ because _adding_ (keep both `checked` and `selected`) will cause the button to be read with both checked and selected states with Android TalkBack reader that may cause confusion to users (watch demo videos). I also did test with iOS segmented control (storyboard) and Android Jetpack Compose to compare: on these native platforms, it announces `selected` state (watch demo videos). <details> <summary>Demo Flutter app - after the fix</summary> | Flutter Android | Flutter iOS | | --------------- | --------------- | <video src="https://github.com/user-attachments/assets/458c9b78-8275-45db-83cb-b2581505d240"/> | <video src="https://github.com/user-attachments/assets/1c69694d-67f8-4f8c-a453-2cf7696e43b5"/> </details> <details> <summary>Demo native platforms</summary> | Android Jetpack Compose | iOS segmented control (storyboard) | | --------------- | --------------- | <video src="https://github.com/user-attachments/assets/5b682c7e-4c50-49be-a613-58673154aa88"/> | <video src="https://github.com/user-attachments/assets/9faba9ea-d373-4756-953a-cde510871247"/> </details> ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Signed-off-by: huycozy <[email protected]> Co-authored-by: Victor Sanni <[email protected]>
- Fix flutter#146987 - As explained at flutter#146987 (comment): this PR proposes _replacing_ `checked` with `selected` here: https://github.com/flutter/flutter/blob/f4de70c6470386db28d23ac5e2e48c681ca23c7a/packages/flutter/lib/src/material/segmented_button.dart#L634 Then VoiceOver can indicate when the button segment is selected. It's _replacing_ action but not _adding_ because _adding_ (keep both `checked` and `selected`) will cause the button to be read with both checked and selected states with Android TalkBack reader that may cause confusion to users (watch demo videos). I also did test with iOS segmented control (storyboard) and Android Jetpack Compose to compare: on these native platforms, it announces `selected` state (watch demo videos). <details> <summary>Demo Flutter app - after the fix</summary> | Flutter Android | Flutter iOS | | --------------- | --------------- | <video src="https://github.com/user-attachments/assets/458c9b78-8275-45db-83cb-b2581505d240"/> | <video src="https://github.com/user-attachments/assets/1c69694d-67f8-4f8c-a453-2cf7696e43b5"/> </details> <details> <summary>Demo native platforms</summary> | Android Jetpack Compose | iOS segmented control (storyboard) | | --------------- | --------------- | <video src="https://github.com/user-attachments/assets/5b682c7e-4c50-49be-a613-58673154aa88"/> | <video src="https://github.com/user-attachments/assets/9faba9ea-d373-4756-953a-cde510871247"/> </details> ## Pre-launch Checklist - [x] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [x] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [x] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [x] I signed the [CLA]. - [x] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant documentation (doc comments with `///`). - [x] I added new tests to check the change I am making, or this PR is [test-exempt]. - [x] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [x] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md Signed-off-by: huycozy <[email protected]> Co-authored-by: Victor Sanni <[email protected]>
checkedwithselectedhere:flutter/packages/flutter/lib/src/material/segmented_button.dart
Line 634 in f4de70c
Then VoiceOver can indicate when the button segment is selected. It's replacing action but not adding because adding (keep both
checkedandselected) will cause the button to be read with both checked and selected states with Android TalkBack reader that may cause confusion to users (watch demo videos). I also did test with iOS segmented control (storyboard) and Android Jetpack Compose to compare: on these native platforms, it announcesselectedstate (watch demo videos).Demo Flutter app - after the fix
Flutter.Android-.with.fix.mp4
Flutter.iOS-with.fix.mov
Demo native platforms
Android.Jetpack.Compose.mp4
iOS.SwiftUI.mov
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.