Repository navigation
feat(a11y): a live tree, and text inputs assistive tech reads and fills - #16
Merged
Merged
Conversation
The accessibility tree is rebuilt after every redraw, once the frame's changes are resolved. Upstream rebuilds it on a poll whose document `has_changes`, which returns `changed_nodes.is_empty()`; `changed_nodes` only records node creation and is never cleared, so after the first node the tree was never rebuilt, and an app built on dioxus-native's launcher (Diaryx) kept its first screen in the tree forever. Leaf's app worked round it by rebuilding after each redraw itself; that call is now redundant. A text input's node has the editor's text as its value (a password's as one dot a character), its placeholder, and the Focus and SetValue actions unless it is disabled (and SetValue unless read-only). `View::accessibility_action` carries them out, and BlitzApplication calls it before falling back to the click events: Focus focuses the node; SetValue focuses the input, selects all of it (`BaseDocument::select_all_in_text_input`) and commits the new text as an IME commit, so the page hears an `input` event as from typing. Behavioural-change: the accessibility tree follows the document after its first build, rebuilt after every redraw while assistive tech listens. Behavioural-change: text inputs expose their value, placeholder and the Focus and SetValue actions, and BlitzApplication carries those actions out.
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.
Two accessibility gaps found driving Diaryx's Mac app by AX element (Diaryx runs on dioxus-native's launcher, so it cannot call
Viewmethods itself as leaf's app does).The tree went stale after the first screen.
View::pollrebuilt it only whenBaseDocument::has_changes(), which returnschanged_nodes.is_empty();changed_nodesonly records node creation and is never cleared, so after the first node the tree was never rebuilt. A press worked, but assistive tech kept reading the first screen. The tree is now rebuilt after every redraw, once the changes are resolved (a no-op while no assistive tech listens). Leaf's own call after each redraw becomes redundant but harmless.Text fields could not be read or filled. An input's text lives in its editor, not in text nodes, so the tree had no value, and only
Clickwas carried out. Now a text input's node has its value (a password as dots), its placeholder, andFocus/SetValue(none when disabled; noSetValuewhen read-only).View::accessibility_actioncarries them out, andBlitzApplicationcalls it before the click fallback:SetValuefocuses the input, selects all (BaseDocument::select_all_in_text_input) and commits the text as an IME commit, so the page hears aninputevent, as from typing.Tests:
tests/blitz-tests/tests/accessibility_text_input.rs(value, placeholder, actions, password, disabled/read-only, replace by select-all + commit).cargo test -p blitz-tests --test all: 321 passed. Clippy is clean for blitz-dom and blitz-shell.To be checked on Diaryx's Mac app with Cua Driver, in the background (diaryx-org/diaryx
accessibilitybranch); results will follow in a comment.WPT results
Subtests: 1621 newly passing, 796 newly failing (net +825). Tests: 20 added, 130 removed. Crashes: +25. Timeouts: -2.
Subtest changes by area (75 areas)
Full diff (283 changed tests)
Generated by the WPT workflow.