Skip to content

Improve Telegram keyboard accessibility and chat announcements - #2

Draft
serrebidev wants to merge 2 commits into
keyang556:mainfrom
serrebidev:agent/improve-telegram-keyboard-accessibility
Draft

Improve Telegram keyboard accessibility and chat announcements#2
serrebidev wants to merge 2 commits into
keyang556:mainfrom
serrebidev:agent/improve-telegram-keyboard-accessibility

Conversation

@serrebidev

Copy link
Copy Markdown

What changed

  • Make Alt+1 reliably focus Telegram's selected or first chat across current layouts.
  • Make Alt+M reliably invoke the main menu in both standard and folder-sidebar layouts.
  • Keep the add-on's shortcuts available when another installed add-on also supplies a Telegram app module, while binding them only when Telegram is foreground.
  • Label Telegram main-menu controls that otherwise expose no useful name, including Main menu, Profile, and Accounts.
  • Preserve Telegram's native Ctrl+Tab and Ctrl+Shift+Tab behavior while announcing the dynamically updated active-chat title.
  • Refresh the add-on-owned app module during NVDA's Reload Add-ons command so newly installed shortcut helpers are immediately available.
  • Update documentation, release metadata to 0.1.4, packaging, and unit coverage.

Why

Telegram's current Qt accessibility tree varies by layout and exposes some controls through RTTI-based class chains rather than stable names. Another Telegram-related NVDA add-on can also win app-module discovery, which made these commands disappear. Telegram paints its conversation header rather than exposing it as a dedicated accessible title control, but it does update the top-level window name after native chat switching.

This change uses provider-side UIA queries and targeted point hit-testing for the chat list and menu, a foreground-aware global shortcut bridge for add-on coexistence, structural labels only for known unnamed controls, and Telegram's updated window name for chat announcements.

User impact

NVDA users can move to the chat list, open and navigate the main menu with meaningful labels, and hear the correct chat name when cycling conversations without losing Telegram's native keyboard behavior.

Accessibility testing and diagnosis

@serrebidev reproduced the failures in live Telegram Desktop, captured timestamped NVDA debug logs for each shortcut and menu state, tested successive fixes, and confirmed the final behavior:

  • NVDA Reload Add-ons completes successfully.
  • Alt+1 focuses the chat list and normal arrow-key navigation continues to work.
  • Alt+M opens the main menu.
  • Previously unnamed structural menu controls announce useful labels such as Profile and Accounts.
  • Ctrl+Tab switches chats natively and announces the actual new chat title dynamically, including Saved Messages rather than a stale prior title.

Validation

  • uv run python -m unittest discover -s tests -v — 20 tests passed.
  • uv run ruff check . — passed.
  • uv run scons — built telegramDesktop-0.1.4.nvda-addon successfully.
  • Manual NVDA testing in Telegram Desktop — passed as described above.

Strict Pyright was also attempted, but this checkout does not include the neighboring NVDA source tree configured in pyproject.toml; unresolved NVDA imports cause cascading baseline type errors in the app module and the existing dynamic test harness.

@keyang556

keyang556 commented Jul 31, 2026

Copy link
Copy Markdown
Owner

Hi @serrebidev, thanks for putting this together — the scope and the accompanying tests/changelog are clearly a lot of careful work.
I tested this against 0.1.3 as a baseline and then 0.1.4 (this PR) side by side, and wanted to share what I found in case it's useful:
Chat title announcement on Ctrl+Tab
In my testing, the announced title stayed the same across chat switches rather than updating (tested twice, ~1.4s and ~0.8s delay each time). I'm not sure if this points to _windowChatTitle() not picking up the updated name in my environment, or something else — happy to share the NVDA log if helpful.
Main menu labels (Alt+M)
I compared the exact same Tab-through sequence on 0.1.3 vs 0.1.4, and the previously-unlabeled buttons (the ones that should map to Profile/Accounts per MAIN_MENU_CLASS_NAMES) still announce as just "button" on both versions — no change. I also noticed the "Main menu" group label itself came through in English rather than through translation, which made me wonder if initTranslation() is resolving correctly when this module gets loaded outside the normal add-on loading path.
I also maintain unigramplus NVDA add-on that has its own fallback logic for detecting telegramDesktop, and with 0.1.4 installed it throws on load:
AttributeError: 'NoneType' object has no attribute '
' and no dict for setting new attributes
This doesn't happen with 0.1.3. My guess is it's related to the same initTranslation() path above, but I could be wrong.
Would you be able to take a look at these, or let me know if you need more detail (logs, repro steps) on any of them? Happy to help test once there's an update.

Copy link
Copy Markdown
Author

Thanks for the detailed testing — I reproduced and addressed all three issues in c86b3fa.

  • Ctrl+Tab title announcement: the add-on now reads the live provider-side window name instead of NVDA's cached object name. If Telegram still exposes the previous title, it falls back to the painted header and OCR. It will no longer announce the old title after retries.
  • Main-menu labels and translations: translated labels are now applied before NVDA builds focus speech, including the focusEntered event for the menu container. Regression tests cover Main menu, Profile, and Accounts, and existing provider-supplied names remain untouched.
  • UnigramPlus compatibility: translation initialization is guarded across importlib.reload, preventing the second initTranslation() call that caused the NoneType error.

During live testing I also found and labeled the two remaining unnamed group-chat top-bar controls as Telegram suggestion and Dismiss suggestion.

Validation completed:

  • 36 unit tests pass
  • Ruff lint and formatting checks pass
  • The Russian, Simplified Chinese, and Traditional Chinese catalogs compile, and the new labels were verified in each compiled catalog
  • The 0.1.4 NVDA add-on package builds successfully
  • The add-on was installed into the running NVDA instance, NVDA restarted successfully, and the installed runtime files matched the tested workspace files

The updated package is ready for another test pass. Thanks again for the clear report.

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