From 4a892e7e0100e542b199c57c75d0aaafc24871ac Mon Sep 17 00:00:00 2001 From: hesam-oxe Date: Sat, 29 Aug 2026 07:48:43 +0000 Subject: [PATCH 1/2] Accessibility: auto-fallback button accessible names AbstractButton now exposes an accessible name from an explicit setAccessibleName() or, as a fallback, its tooltip, so icon-only buttons (close, mute, record, play) are named for screen readers without per-call-site fixes. FlatButton and SettingsButton also set the name from their text. --- ui/abstract_button.cpp | 12 ++++++++++++ ui/abstract_button.h | 1 + ui/widgets/buttons.cpp | 2 ++ 3 files changed, 15 insertions(+) diff --git a/ui/abstract_button.cpp b/ui/abstract_button.cpp index 3eb5ccbad..5649fb8a5 100644 --- a/ui/abstract_button.cpp +++ b/ui/abstract_button.cpp @@ -223,6 +223,18 @@ void AbstractButton::clearState() { onStateChanged(was, StateChangeSource::ByUser); } +QString AbstractButton::accessibilityName() { + const auto custom = QWidget::accessibleName(); + if (!custom.isEmpty()) { + return custom; + } + const auto tip = toolTip(); + if (!tip.isEmpty()) { + return tip; + } + return QString(); +} + AccessibilityState AbstractButton::accessibilityState() const { return { .pressed = isDown() }; } diff --git a/ui/abstract_button.h b/ui/abstract_button.h index 2eea6dfcb..07dff42cf 100644 --- a/ui/abstract_button.h +++ b/ui/abstract_button.h @@ -77,6 +77,7 @@ class AbstractButton : public RpWidget { ? QAccessible::ButtonMenu : QAccessible::Button; } + QString accessibilityName() override; AccessibilityState accessibilityState() const override; void accessibilityDoAction(const QString &name) override; diff --git a/ui/widgets/buttons.cpp b/ui/widgets/buttons.cpp index 4637ed5d3..54cf9c7fd 100644 --- a/ui/widgets/buttons.cpp +++ b/ui/widgets/buttons.cpp @@ -239,6 +239,7 @@ FlatButton::FlatButton( void FlatButton::setText(const QString &text) { _text = text; + setAccessibleName(text); accessibilityNameChanged(); update(); } @@ -1056,6 +1057,7 @@ void SettingsButton::onStateChanged( void SettingsButton::setText(TextWithEntities &&text) { _text.setMarkedText(_st.style, text, kMarkupTextOptions, _context); + setAccessibleName(_text.toString()); accessibilityNameChanged(); update(); } From 14396a3eb13e042e41c59b0bbb291636be0c6f52 Mon Sep 17 00:00:00 2001 From: hesam-oxe Date: Sat, 29 Aug 2026 08:14:37 +0000 Subject: [PATCH 2/2] Accessibility: announce context menu open to screen readers When a PopupMenu opens while a screen reader is active, fire a QAccessible::Focus event on the menu so NVDA/JAWS/ORCA announce it immediately instead of waiting for the next focus change. --- ui/widgets/popup_menu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/widgets/popup_menu.cpp b/ui/widgets/popup_menu.cpp index b29624cae..339c241cb 100644 --- a/ui/widgets/popup_menu.cpp +++ b/ui/widgets/popup_menu.cpp @@ -23,6 +23,7 @@ #include "ui/ui_utility.h" #include +#include #include #include #include @@ -1172,6 +1173,8 @@ void PopupMenu::showPrepared(TriggeredSource source) { activateWindow(); if (Ui::ScreenReaderModeActive()) { _menu->setShowSource(TriggeredSource::Keyboard); + QAccessibleEvent event(this, QAccessible::Focus); + QAccessible::updateAccessibility(&event); } else { _menu->setShowSource(source); }