Fix TextInput placeholder invisible to assistive technologies#1832
Open
Stasshe wants to merge 2 commits into
Open
Fix TextInput placeholder invisible to assistive technologies#1832Stasshe wants to merge 2 commits into
Stasshe wants to merge 2 commits into
Conversation
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.
Fix
TextInputplaceholder invisible to assistive technologiesFixes #1701
Problem
TextInput's AccessKit representation exposed the placeholder text twice:Labelchild node (used only for painting).accesskit::Node::set_placeholder, called on the parentGenericContainernode instead of theTextAreanode it actually describes.Assistive technologies could not associate the placeholder with its text input, and screen readers announced the redundant label as a separate element.
Fix
TextAreagained aplaceholderfield andTextArea::set_placeholder, so the placeholder is set on theTextInput's inner AccessKitTextInput-role node (theTextArea), not its container.TextInput::accessibilityno longer callsnode.set_placeholderon the container node.NewWidget::accessibility_hidden(bool)(backed by a newaccessibility_hiddenflag onWidgetOptions/WidgetState), which omits a widget and its whole subtree from the AccessKit tree without touching layout, painting, or event handling.TextInput's visual placeholderLabelis now created with.accessibility_hidden(true), so it's no longer published to the accessibility tree at all.run_accessibility_passskips building nodes under a hidden subtree, filters hidden children out ofset_children, drops the root widget's node when hidden, and redirectsfocusaway from a hidden widget to the window node.Testing
masonry::tests::accessibility::accessibility_hidden_omits_subtree— a hidden widget and its descendants are absent from the tree, and its parent has zero exposed children.masonry::widgets::text_input::tests::placeholder_is_exposed_on_text_area_accessibility_node— the placeholder is set on theTextAreanode (not the rootTextInputnode), the visual placeholderLabelhas no accessibility node, and the root exposes exactly one child. Updated afterset_placeholderis called to confirm live updates propagate.cargo test -p masonry --lib accessibilitypasses.