Fix: Correct semantic binding issue#341
Merged
cedvdb merged 4 commits intocedvdb:mainfrom Jan 2, 2026
Merged
Conversation
This commit addresses accessibility issues in the PhoneFormField by ensuring the country selector button is properly exposed to accessibility services. Previously: - The PhoneFieldSemantics widget wrapped the entire PhoneFormField, using ExcludeSemantics to hide the internal components (including the country selector button) from the accessibility tree. - The CountryButton itself lacked proper semantic labeling, making it difficult for screen readers to convey its purpose. Changes Made: - Removed the redundant PhoneFieldSemantics widget and its corresponding file (). The TextField now provides its own semantics, which is sufficient. - Enhanced the CountryButton widget () by wrapping its content in a Semantics widget. This new Semantics widget provides a descriptive label including the current country's name and dial code, and marks it as a button, allowing screen readers to correctly identify and interact with it. - Removed the import statement for from . Impact: - Users relying on screen readers can now properly interact with and understand the purpose of the country selector button in the PhoneFormField, significantly improving accessibility.
Closed
|
@cedvdb can we have this merged and released please? |
WillCallahan
commented
Dec 31, 2025
Contributor
Author
|
I have made the required updates and tested this |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR resolves a critical accessibility issue where the country selector button within
PhoneFormFieldwas inaccessible to screen reader users.How to Reproduce the Error
The issue can be reproduced by enabling semantics in your app, for example, by adding the following lines to your
main.dart:With semantics enabled, the country selector button was not focusable or interactive for screen readers.
The Fix
The problematic
PhoneFieldSemanticswidget has been removed. TheCountryButtonnow provides its own correct semantic information (descriptive label, button role), allowing screen readers to interact with it properly.Impact
Screen reader users can now correctly focus, understand, and activate the country selector.
Testing
To test this change:
PhoneFormField.Related Issues
Checklist
Supporting Documentation
SemanticsWidget: The primary widget for providing accessibility information.ExcludeSemanticsWidget: The widget that was causing the issue by hiding theTextFieldfrom assistive technologies.