-
Notifications
You must be signed in to change notification settings - Fork 811
Description
Feature Description
AccessKit NodeId is a newtype over u64. The current scheme for Slint is as follows:
- Component ID: upper 32 bits
- Item Index: lower 32 bits
Where Component ID is an increasing u32 mapped to an ItemTree pointer and Item Index is just the index of a given item in its tree.
To address #2895 we need to reserve space for AccessKit nodes that don't map to any construction in Slint, the text runs.
@tronical suggested in AccessKit/accesskit#655 (comment) that Slint could just host newly introduced graft nodes and let parley provide subtrees for each block of text. This is unpractical as nodes cannot reference other nodes across subtrees. If text inputs are in the root tree then they cannot reference text runs in the subtree for text selection. If text inputs are also part of the subtree, then we won't ever be able to support "labelled by"/"described by" relationships for these element (I know Slint currently doesn't allow this but this is a common pattern, especially for form inputs). Subtrees are designed to host semantically unrelated fragments of the UI, like a web view or a rich document editor, not for small widgets like text inputs.
Given this:
- How many text runs should we consider? Raw text needs one text run per line up to 256 characters. Rich text needs one text run for each span (think different text style, font, color...)
- Why do item indices need to be an u32? Since they have to be declared explicitly and cannot repeat, this seem massively overkill to me.
- How many components IDs are needed in practice? Components can be repeated but some of them are also temporary.
In my opinion, u16 would already be quite large for item indices, 24 bits would be enough to address text runs for practically every text inputs and 24 bits should be fine to map components for reasonably large UIs.
Any thoughts? I am willing to submit a pull request once we land on a decision.
Product Impact
Part of the NLNet funded project iOS Support for AccessKit