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
Check harder before enabling Accessibility support on Win32 #7611
Conversation
@@ -18,6 +18,8 @@ | |||
#include "atom/browser/ui/win/message_handler_delegate.h" | |||
#include "atom/browser/ui/win/taskbar_host.h" | |||
#include "base/win/scoped_gdi_object.h" | |||
#include "ui/base/win/accessibility_misc_utils.h" |
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.
Just curious, what is this include used for?
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.
@kevinsawicki Without it, the next header barfs a thousand lines of COM nonsense
} | ||
if (checked_for_a11y_support_) return false; | ||
|
||
checked_for_a11y_support_ = true; |
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.
On this branch (compared with master), I'm not seeing the 'accessibility-support-changed'
event fire when you launch NVDA after launching your app:
To reproduce:
- Launch Electron
- Open the dev tools and run the following
require('electron').remote.app.on('accessibility-support-changed', function(e, axs) {console.log('changed', axs)})
- Launch NVDA
- 'changed true` is not logged on this branch (it is logged on master)
Should the checked_for_a11y_support_ = true;
be done after the if (obj_id != OBJID_CLIENT) {
check? If I move it below that check, then I do see it fire.
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.
We can do that, I was trying to make this as efficient as possible but I didn't know we had an event for this, 👍
@@ -228,6 +230,9 @@ class NativeWindowViews : public NativeWindow, | |||
// In charge of running taskbar related APIs. | |||
TaskbarHost taskbar_host_; | |||
|
|||
// Memoized version of a11y check | |||
bool checked_for_a11y_support_; |
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.
This should be initialized to false
in the constructor like enabled_a11y_support_
is in atom/browser/native_window_views.cc
const auto axState = content::BrowserAccessibilityState::GetInstance(); | ||
if (axState && !axState->IsAccessibleBrowser()) { | ||
axState->OnScreenReaderDetected(); | ||
enabled_a11y_support_ = true; |
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.
I think this variable can be removed now, it looks like it is no longer read anywhere.
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.
👍
Thanks so much for fixing this 💻 🔍 |
@paulcbetts, why didn't you do it like this?
That would be much cleaner. |
@paulcbetts did you try running Electron first and then running the screen reader? You only check if it's running once. |
I did try this and it worked as expected but I wasn't on a touch screen. I launched Electron, then opened NVDA, and saw the accessibility state changed event fire. |
@kevinsawicki, I am experimenting with this. Looks like the whole WM_GETOBJECT handling code may not be even necessary. JAWS, NVDA and Window-Eyes trigger the accessible mode without that. Narrator and ZoomText only work if they were running before Electron was launched. |
Also the |
Unfortunately there is no notification for |
Also, on my Windows 10 in Parallels on Mac, |
@paulcbetts Thank you very much for the fix! ❤️ |
Fixes #7208
TODO: