Skip to content

Feat: Accessible-name fallback for UI buttons (screen reader support) - #31197

Draft
hesam-oxe wants to merge 2 commits into
telegramdesktop:devfrom
hesam-oxe:feat/accessibility-base-refactor
Draft

Feat: Accessible-name fallback for UI buttons (screen reader support)#31197
hesam-oxe wants to merge 2 commits into
telegramdesktop:devfrom
hesam-oxe:feat/accessibility-base-refactor

Conversation

@hesam-oxe

Copy link
Copy Markdown

Summary

Fixes the missing accessible names reported for icon-only buttons in issue #476. Ui::AbstractButton now exposes an accessible name automatically:

  • If an explicit setAccessibleName() was set, it is used as before.
  • Otherwise the button's toolTip() is used as a fallback.

FlatButton and SettingsButton also call setAccessibleName() from their text, so screen readers (NVDA/JAWS/ORCA) can announce every button without per-call-site fixes.

This is the foundational, low-risk part of the accessibility work: it gives every button a name. The deeper focus-navigation (chat-list tab order), context-menu focus announcements, inline-media InvokePattern, and voice-recording keyboard alternatives discussed in #476 are planned follow-ups and are NOT part of this PR.

Where the code lives

The implementation is in the lib_ui submodule:

  • hesam-oxe/lib_ui@feat/accessibility-base-refactor (PR to desktop-app/lib_ui)
  • AbstractButton::accessibilityName() in ui/abstract_button.cpp
  • FlatButton::setText / SettingsButton::setText in ui/widgets/buttons.cpp

This tdesktop PR only bumps the lib_ui submodule pointer to that commit and adds a standalone verification snippet under Telegram/SourceFiles/test/accessibility_names_snippet.cpp (not wired into the CMake build; it compiles against Qt directly).

Testing

The fallback logic was verified with a standalone Qt program (offscreen platform) covering: icon-only button -> tooltip becomes the name; explicit accessibleName() wins; empty when neither is set. Full integration build is performed by the maintainer toolchain.

Related

@CLAassistant

CLAassistant commented Aug 29, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@ilya-fedin

Copy link
Copy Markdown
Collaborator

The same problem as in #31198: wrong lib_ui commit

@hesam-oxe
hesam-oxe force-pushed the feat/accessibility-base-refactor branch from c306323 to 3c27914 Compare September 13, 2026 07:05
@hesam-oxe

Copy link
Copy Markdown
Author

@cla-assistant check

@hesam-oxe
hesam-oxe force-pushed the feat/accessibility-base-refactor branch from 3c27914 to 5381c1f Compare September 13, 2026 07:57
@hesam-oxe

Copy link
Copy Markdown
Author

@ilya-fedin Same fix here — the submodule no longer points into my fork and stays on the upstream commit.

For transparency: parts of the tdesktop-side code (the sub-item InvokePattern support in HistoryInner / ListWidget) override the new accessibilityChildSubItem* virtuals introduced in desktop-app/lib_ui#356, so this branch will not compile against upstream lib_ui until that PR merges. I have marked it as draft accordingly; once #356 lands I will bump the submodule to the merged upstream commit and ping you for re-review. The remaining changes (voice-record toggle, focus handling, reply links, dialog key handling) are plain tdesktop/Qt code and independent of the lib_ui change.

@hesam-oxe
hesam-oxe marked this pull request as draft September 13, 2026 08:01
@ilya-fedin

Copy link
Copy Markdown
Collaborator

Same question as for #31198 - should the test land upstream?

When a screen reader is active, keyboard users can start and stop voice recording with Space or Enter on the focused record button, and cancel with Escape, since press-and-hold is not reachable from the keyboard.
…nks)

Implement the remaining accessibility follow-ups from issue telegramdesktop#476:

- Chat list focus traps: let Tab/Shift+Tab leave the dialog list under screen reader mode so keyboard focus is not trapped.
- Inline media InvokePattern: message sub-items (media, download, played, web) now expose a press action via the new Ui::Accessible::SubItem action interface, so screen readers can invoke them.
- Reply/quote link actions: the Reply sub-item is invokable and jumps to the original message.

Requires the lib_ui submodule change that makes Ui::Accessible::SubItem implement QAccessibleActionInterface and adds RpWidget sub-item action virtuals.

NOTE: full functional verification needs a Qt6 build environment (the desktop-app Linux build compiles patched Qt6 from source in Docker); this was not available here, so CI validation is requested.
@hesam-oxe
hesam-oxe force-pushed the feat/accessibility-base-refactor branch from 5381c1f to b686ddd Compare September 13, 2026 17:23
@hesam-oxe

Copy link
Copy Markdown
Author

@ilya-fedin You're right, and honestly — no, it shouldn't. That snippet was a scratch verification file written during development of the lib_ui changes (it has its own main() and isn't wired into the build or Test::Runner), and it slipped into this branch when I split the work across repos. I've dropped it from the branch (b686ddd): the PR now contains only the functional commits — the voice-record keyboard toggle and the focus/invoke/reply-link work.

For completeness on the shape of this PR: it depends on the lib_ui-side changes in desktop-app/lib_ui#356 and desktop-app/lib_ui#357; the plan was to bump the submodule here once those land upstream, which is why it's a draft. If you'd rather see it reworked differently (or not at all until lib_ui is settled), just say the word.

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.

3 participants