-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Accessibility: Make screen readers announce UI actions #28592
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
9fc7a1a
to
c27a41a
Compare
38ed158
to
28b7f50
Compare
fba2c32
to
86c6ae6
Compare
src/framework/accessibility/internal/accessibilitycontroller.cpp
Outdated
Show resolved
Hide resolved
src/framework/accessibility/internal/accessibilitycontroller.cpp
Outdated
Show resolved
Hide resolved
1efab15
to
5a1baac
Compare
5a1baac
to
5f2e76c
Compare
55374e7
to
751326a
Compare
dispatcher->preDispatch().onReceive(this, [this](const actions::ActionCode*) { | ||
// About to perform an action. Let's store some values to see if the action changes them. | ||
m_preDispatchFocus = m_lastFocused; | ||
m_preDispatchName = m_preDispatchFocus ? m_preDispatchFocus->accessibleName() : QString(); | ||
m_announcement.clear(); // So we can detect if the action sets its own announcement. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@igorkorsukov, are channel onReceive
functions always called synchronously, or is there a risk that the action was already performed by the time this code executes?
The idea is to store some values before the action is performed, then check them afterwards to see if they were altered by the action.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if the sender and receiver are in the same thread, then always synchronously
751326a
to
e381d40
Compare
e381d40
to
623c539
Compare
Create function AccessibilityController::announce(QString) that makes the screen reader speak an arbitrary message. Unlike conventional screen reader speech, announcements are not limited to reporting that an item has gained focus, or that one of the focus item's attributes has changed (although the function works by pretending that at least one of those events has occurred).
Fix musescore#20041 No screen reader feedback when performing in-score actions Fix musescore#20000 Change of voice not announced by screen reader
Override the normal action announcement because these are toggling actions, so the action name is always the same regardless of whether you are entering or exiting the mode.
PR musescore#27776 restricted it so the score had to have focus, but there are a couple of other places where it should work too.
Fix musescore#20554 Input state not announced in Braille panel
AccessibleRoot::commandInfo() only worked in the score whereas AccessibilityController::announce() works in all areas of the UI.
623c539
to
c859cb1
Compare
Resolves:
Adds function
AccessibilityController::announce(QString)
that can be used to make the screen reader speak an arbitrary message not covered by standard accessibility events.The
announce()
function can be used to report that an action was performed, a different mode was entered, or a change occurred to an item that isn't the current focus item.Important
The
announce()
function shouldn't be (ab)used to report standard accessibility event types covered byQAccessibleEvent
and its subclasses, such as changes in focus, or changes to the value, state, or text property of the focus item, unless such events are ignored or misreported by a particular screen reader.Example annoucements:
Some things could be improved, but these are left for a future PR:
For clues implementing announcements, see how most announcements come from UI Action titles, but this can be overriden for a particular action by setting a custom announcement, as is done with the note input actions.