AccessKit / AccessKit/accesskit
Case for revised data model: labelled_by
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.5k
- Forks
- 114
- Avg merge
- 8h 25m
- Merged PRs (30d)
- 28
Description
Context
If I understand correctly, the labelled_by property allows one Node to be labelled by another, for example a CheckBox with a separate Label widget, both wrapped under some CheckBoxWithLabel widget.
The CheckBox widget doesn't know about the Label (which is external), hence the labelled_by property can only be set by the parent widget (unless the parent explicitly asks the CheckBox to store the identifier of its label, but this is a restrictive and over-complex design).
Motivation: partial tree updates
In the case that a full accessibility tree must be generated the above is fine, but in the case that the CheckBox value changes and the widget tries to update its Node value in the accessibility shadow-tree, it's harder to do this without losing the labelled_by relationship.
Suggestions
I can see a couple of possible solutions here:
- Allow access to the prior state of nodes in the accessibility tree: then
CheckBoxcan copy its old value and update it. (This change is quite significant and may be undesirable.) - Move the
labelled_byproperty out ofNodeto another data structure (e.g.Vec<(NodeId, NodeId)>). Logically a node cannot label more than one other node; this should be enough to allow old (outdated/redundant)labelled_byrelationships to be pruned (though it doesn't allow such relationships to be removed; I suspect this is unimportant). - This is a hack, but might not work out too badly in practice: whenever a
Nodeis replaced and the old one has alabelled_byproperty while the newNodedoesn't, copy the property to the newNode. (The side effect is the same as with (2): updates cannot remove alabelled_byrelationship.)
Final note
Most Node properties are not affected the same way, though some others may be (possibly radio box groups; I didn't investigate since Kas's widget model doesn't have the necessary data to set this anyway).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the Node data model and the accessibility shadow-tree partial-update path, focusing on how labelled_by is assigned and preserved when a Node is replaced. The issue presents three possible designs but does not select one; done would require an agreed data model and defined behavior for retaining or removing labelled_by relationships.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- accessibility
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100