Skip to content

feat(accessibility): support SetFocus and Press actions on painted list items#303

Open
rezabakhshilaktasaraei wants to merge 2 commits into
desktop-app:masterfrom
rezabakhshilaktasaraei:accessibility/item-set-focus
Open

feat(accessibility): support SetFocus and Press actions on painted list items#303
rezabakhshilaktasaraei wants to merge 2 commits into
desktop-app:masterfrom
rezabakhshilaktasaraei:accessibility/item-set-focus

Conversation

@rezabakhshilaktasaraei

@rezabakhshilaktasaraei rezabakhshilaktasaraei commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Painted/virtual list items exposed via Accessible::Item advertise themselves as focusable, but they provided no QAccessibleActionInterface — so a screen reader could neither move focus to such an item (UIA SetFocus) nor activate it (UIA Invoke).

This makes Accessible::Item implement QAccessibleActionInterface, but only for children whose owner opts in:

  • RpWidget::accessibilityChildSupportsActions(index) (default false) gates the interface; interface_cast returns nullptr otherwise, so unrelated painted lists don't advertise no-op Invoke / SetFocus / Select on Windows.
  • actionNames() advertises pressAction(), setFocusAction() (when the row is focusable) and toggleAction() (when selectable — Qt routes UIA SelectionItem.Select through it on the Qt 5 bridge).
  • doAction() routes press → accessibilityChildActivate, focus/toggle → accessibilityChildSetFocus.

Actions are dispatched by a stable identity, not by index: the owner provides accessibilityChildIdentity(index) / accessibilityChildIndexByIdentity(token), and the action virtuals take that token. The owner resolves it to the current row on the main thread, so a reorder or replacement can't make a queued action hit the wrong row. A cached item is also dropped when the row at its index changes identity.

All the new RpWidget virtuals default to no-ops / empty, so a widget opts in explicitly (e.g. the chat list).

@rezabakhshilaktasaraei rezabakhshilaktasaraei changed the title feat(accessibility): support SetFocus action on painted list items feat(accessibility): support SetFocus and Press actions on painted list items Jun 6, 2026
@rezabakhshilaktasaraei rezabakhshilaktasaraei force-pushed the accessibility/item-set-focus branch 2 times, most recently from c672f53 to 17b275e Compare June 28, 2026 16:45
@rezabakhshilaktasaraei rezabakhshilaktasaraei force-pushed the accessibility/item-set-focus branch from 17b275e to 329041b Compare July 2, 2026 13:25
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