Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QAccessibilityEvent not being seen by screen reader or Accessibility Insights
Marc Sabatella last edited by Marc Sabatella
I am working to improve the accessibility in MuseScore, which currently uses Qt 5.9.8 but will move to Qt 5.12 once we are able to work out the remaining issues. Everything I'm saying here applies to Windows, which is the only platform I personally am building and testing on, but once I get things working better, I am hopeful it will carry over to macOS and Linux.
Bottom line: I am unable to get an event we send to be seen or recognized by screen readers, or by Microsoft's Accessibility Insights tool, in Qt 5.12.
The primary thing I am trying to make happen is to have the screen reader read some text (a more friendly version of the status bar text) in response to various user actions. Our current implementation works with NVDA but nothing else, and that's what I want to fix.
We have been using a custom widget with accessibility implemented via QAccessibleWidget (installed via a factory) and sending a QAccessibleValueChangeEvent via updateAccessibility(). This worked with NVDA (only) in Qt 4 and Qt 5.9. It stopped working even with NVDA as of Qt 5.12 but started working again recently due to some changes both in Qt and in NVDA (see https://github.com/nvaccess/nvda/issues/8604), and we're almost ready to move our builds to Qt 5.12.
Meanwhile, I'm trying to get our custom widget working in other screen readers. So far I've managed to make some tweaks to our code (most notably, changing the Role of our custom widget to StaticText rather than the default Client, or NoRole, which we had used previously) that allow JAWS to start responding. Still no Narrator, though. And unfortunately, this helps only in Qt 5.9.8. When I build with Qt 5.12.5, it's back to working with NVDA only. I will try Qt 5.12.6 next, but I don't see anything relevant in the change log so I'm not optimistic.
The bottom line seems to be, the QAccessibleValueChangeEvent that we send is seen by NVDA but does not seem to be making it out to the rest of the world. Microsoft's Accessibility Insights tool does not register anything relevant when I listen for events in our app built with Qt 5.12.5. With Qt 5.9.8, I do see some events in Accessibiltiy Insights, although I'm not sure they are actually what they should be, which might be why Narrator doesn't respond. I'm learning as I go, so I'm not really sure what the events should look like, but something is better than nothing, and Qt 5.9.8 shows something and Qt 5.12.5 shows nothing.
While the event doesn't seem to register, the changed text itself is there in the value of the object. I can see it in Accessibility Insights, and JAWS & Narrator will both read it if you explicitly invoke their own "read current object" commands. But only NVDA responds automatically when we send the event. I have no idea what it is responding to, but I'm guessing it's something internlal to Qt and that the event is in fact not being posted normally to the OS.
I have a notion that maybe we need to do something special to tell the system we intend to use these value change events. Maybe StaticText doesn't use them by default and there might be a way to add that info? I tried a whole bunch of roles before settling on that one as working best in Qt 5.9.8 - it's the only one I could find JAWS would respond to an event for or that Narrator would read at all (with manual assist from the user). I also tried a vsriety of other events (including DescriptionChanged) with no success.
I also know we have issues managing the focus within MuseScore, and there are times when the screen reader thinks focus is somewhere other than on our custom widget even though we have explicit setFocus() calls and in other respects focus does seem to be there. But I don't think that can explain the event not being seen in Accessibiltiy Insights at all.
I see there exist in the world things like ARIA live regions for this sort of thing, but I don't see any way to implement that with Qt, so I'm assuming our current approach is still the way to go.
Any ideas? I'm not sure if this is just an out and out bug in Qt - events not just being send., period - or something we are doing wrong. And I don't know how to create a minimal example from scratch.
I recommend to bring that issue to the interest mailing list. You'll find there Qt developers/maintainers. This forum is more user oriented.
Marc Sabatella last edited by
@SGaist Thanks for the suggestion. I've tried to subscribe to that list but no response so far...
Are you sure your email went through ?