UI Accessibility: expose painted (non-QWidget) items as accessible children via Accessible::Item #278
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.
This PR adds accessibility support for painted UI elements that are not real QWidgets (i.e., items drawn inside a widget). The goal is to make these “virtual” elements appear in the accessibility tree so screen readers can discover, navigate, and interact with them.
Summary
•
Introduces Ui::Accessible::Item (QAccessibleInterface) plus AccessibleItemWrap to represent non-QWidget / non-QObject painted items as accessibility nodes.
•
Extends RpWidget with a simple API to expose painted items as accessibility children via accessibilityChildInterface(index), along with optional text hooks:
•
accessibilityChildName(int)
•
accessibilityChildDescription(int)
•
accessibilityChildValue(int)
•
Updates Ui::Accessible::Widget to use the new interface-based child API and support:
•
correct child lookup (child(index))
•
hit-testing for painted items (childAt(x, y))
•
improved focus reporting (focusChild() returns the focused/selected painted item when the widget has focus)
•
Removes the old widget-only child accessibility methods on RpWidget (accessibilityChildAt, accessibilityIndexOfChild, accessibilityFocusChild) since they don’t fit painted-item scenarios.
Why
A lot of our UI is rendered manually (custom painting) rather than composed from actual Qt widgets. Without explicit QAccessibleInterface objects, those elements are invisible to assistive technologies. This change provides a clean path to expose painted items with proper role, state, geometry, and text, without requiring them to be real widgets.
Notes
•
Item geometry is mapped to global coordinates for accurate screen reader hit-testing.
•
Validation ensures the parent widget exists and indices are within bounds when a child count is provided.
Testing
•
Manual verification with a screen reader:
•
painted items are discoverable in the accessibility tree
•
hit-testing works (childAt returns the correct item)
•
focus/selection is reflected correctly for painted items