Skip to content

Move AccessKit integration to examples - #716

Open
DataTriny wants to merge 3 commits into
linebender:mainfrom
DataTriny:accesskit-in-examples
Open

Move AccessKit integration to examples#716
DataTriny wants to merge 3 commits into
linebender:mainfrom
DataTriny:accesskit-in-examples

Conversation

@DataTriny

Copy link
Copy Markdown

As discussed at RustWeek 2026, the current API of the AccessKit integration is not a great fit for many consumers.

The conclusion we reached was that removing the integration entirely would allow users to design their own according to their needs. The existing integration can be moved to the vello_editor example to serve as a reference implementation or a starting point.

This require making some items public though.

The changes here are mostly mechanical. I am guessing that most of the changes made to parley's API will be controversial, so this pull request should be considered as a way to open the discussion, not necessarily as something to merge as is.

See slint-ui/slint#2895 for my current motivation.

Building an AccessKit-style integration outside Parley requires a handful
of details that were either private or gated behind the `accesskit`
feature. Make them public:

- `Layout::text_len` and `Layout::alignment`
- `Cursor::upstream_cluster` and `Cursor::downstream_cluster`
- `ClusterPath::new`
- the `Style::locale` field
- `PlainEditor::is_cursor_visible`
- `PlainEditorDriver::set_selection`

`LayoutData::alignment` and `Style::locale` are no longer gated on the
`accesskit` feature, and `LayoutData::clear` now resets the alignment so
that `Layout::alignment` cannot report a value left over from a previous
build.
`vello_editor` is the only example that opens a window, and so the only
one that can expose a tree to assistive technologies. Add the integration
to it directly, as `accessibility.rs`, and stop enabling Parley's
`accesskit` feature.

The module is a copy of Parley's internal integration, rewritten against
the public API. `LayoutAccessibility` covers read-only layouts;
`PlainEditorAccessibility` builds on it with the editor-specific parts, so
a consumer only has to supply its own brush conversion. Three details that
relied on private state are now expressed differently: the style index
comes from `Cluster::style_index`, the alignment from `Layout::alignment`,
and the trailing hard line break is detected with
`Cluster::is_hard_line_break` on the last byte rather than by inspecting
the shaped text.
Remove the `accesskit` feature along with the `accesskit` and `skrifa`
dependencies it pulled in.

This removes `LayoutAccessibility`, `PlainEditor::try_accessibility`,
`PlainEditorDriver::{accessibility, select_from_accesskit}`,
`Cursor::{from_access_position, to_access_position}`, and
`Selection::{from_access_selection, to_access_selection}`.
@DataTriny
DataTriny force-pushed the accesskit-in-examples branch from 0951e74 to bdc6bf1 Compare July 28, 2026 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant