Repository navigation
Conversation
This was referenced Oct 30, 2026
This is requires to support setting the ARIA accessible name of an element through the _host language text_ of an element, especially an associated `<label>` element. This also adds support for setting the label through other forms of the host language text: - The `alt` text of an `<img>` tag. This is needed both for dioxus-test and to allow assistive technologies to correctly name many elements.
This usees the same method as with `aria-labelledby` as per the [W3C spec](https://www.w3.org/TR/accname-1.2/#mapping_additional_nd_description) for accessible description. This also copies the description text into the accesskit nodes. Performance tests show that this normally has a negligible impact on both CPU and memory use. There is one "pathological" case where it has a significant impact: if many nodes all point to the same shared description, then that description will be copied once per node. That presumably doesn't happen often in practice, but it is worth considering. The solution, if necessary, is either to compute the description lazily or to modify accesskit itself to use shared ownership.
hovinen
force-pushed
the
refactor-aria-tree-building
branch
from
October 30, 2026 12:22
570cc35 to
5d93cb1
Compare
This branch has not been deployed
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.
The existing code to build the accesskit tree from a
BaseDocumentwas quite hard to follow, since various steps had to happen in a specific order so as to be compliant with the standard. It was not easy to assign different aspects of the computation to the various components.This restructures the mechanism, making the following key changes:
TreeBuilder.aria-labelledbyandaria-describedbyattributes as well as the<label for="...">construct. The second builds the accesskit nodes themselves. Thus forward references are already resolved when the accesskit nodes are built, making the process more straightforward.std::collections::HashMapandstd::collections::HashSetwith equivalents from therustc-hashcrate to provide faster hashing. Since the keys are internally generatedNodeId's, there is no risk of DoS attack due to key collisions.Experiments show that these changes reduce the runtime for accesskit tree construction by about 10% compared with the previous state.
This builds on #1259.
WPT results
No changes in test results compared to
main.Generated by the WPT workflow.