Skip to content

feat(accessibility): support PageTab role and selected state on buttons#304

Open
rezabakhshilaktasaraei wants to merge 1 commit into
desktop-app:masterfrom
rezabakhshilaktasaraei:accessibility/page-tab-selection
Open

feat(accessibility): support PageTab role and selected state on buttons#304
rezabakhshilaktasaraei wants to merge 1 commit into
desktop-app:masterfrom
rezabakhshilaktasaraei:accessibility/page-tab-selection

Conversation

@rezabakhshilaktasaraei

Copy link
Copy Markdown
Contributor

Summary

Adds the building blocks to expose buttons as accessible page tabs (used by Telegram Desktop to turn the chat-folders strip into a screen-reader tab control):

  • AbstractButton: setIsPageTab() / isPageTab(), and accessibilityRole() returns PageTab when set (alongside the existing ButtonMenu/Button).
  • AccessibilityState: new focused field, written OR-only in writeTo() so the real keyboard-focus state from QAccessibleWidget is never cleared — used to mark the active tab as focused, the way QAccessibleTabButton marks QTabBar's current tab.
  • SideBarButton: accessibilityState() reports focused = _active for a page tab, so the active side-bar item is exposed as the selected/focused tab.

On Windows, the screen reader's "selected" announcement for a PageTab additionally relies on a small qtbase UIA patch (exposing the SelectionItem pattern for PageTab, which Qt 6 already does); the role/focus work regardless.

Comment thread ui/rp_widget.cpp
state.selected = selected ? 1 : 0;
// Only ever set focused, never clear it, so the real keyboard-focus
// state from QAccessibleWidget is preserved. Used to expose the active
// tab as focused, the way QTabBar marks its current tab.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QAccessibleTabBar seem to manipulate with focused state only because the child items aren't real widgets. Since you're changing RpWidget, I assume they're real widgets in our case and you can use setFocus instead.

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.

2 participants