fix screen reader mode issues
fixes #167627
@alexdima would be a better review than me here
@deepak1556 do OSS and insider's use different versions of chromium or have different values for AutoDisableAccessibility?
OSS based on this branch works when I toggle VoiceOver but an Insider's build based on this branch does not.
Logging shows that when I toggle VoiceOver in OSS, the screen reader change is detected whereas in Insider's it is not.
I noticed in Chromium documentation that AutoDisableAccessibility is off by default. Could that be the issue?
fyi @isidorn
@meganrogge I also looked at #167998 and this PR seems to also change areas changed there, but in a different way. Which version do you want to do?
Insiders and OSS use different Electron builds. OSS uses builds from https://github.com/electron/electron/releases/tag/v21.3.3 whereas product builds are from https://domoreexp.visualstudio.com/Teamspace/_git/electron-build which contain Chromium/Electron patches specific to VSCode.
For this specific case, AutoDisableAccessibility feature is off by default in Chromium but it is enabled for all builds of VSCode via runtime flag https://github.com/microsoft/vscode/blob/1e4ac3149ef3ed48115663b92caa128aedff91da/src/main.js#L242-L245
In this iteration, we added a patch to product builds of Electron that rewires accessibility detection on all platforms. The regression with insiders seems highly likely to originate from that change, I did test the change on macOS ventura and voice over detection worked fine, @meganrogge what is your macOS version ?
@alexdima I separated the PRs because they attempt to fix different things -
#167998 fixes the case when you toggle the accessibility mode and it should impact all windows
This one attempts to fix an issue where toggling voice over (or other screen reader) does not cause our accessibility mode to update
@deepak1556 I am on macOS Ventura - is there a way to test that the switch is on? source maps aren't loading for me in insider's or i'd try to debug and hit a breakpoint to check
It works for me when I turn VoiceOver on, but not when I turn it off in insider's. I don't think that's a regression bc from my understanding, this detection was added last iteration
oss:
https://user-images.githubusercontent.com/29464607/205668110-975ef247-15db-4a4d-85af-7a5129f776e0.mov
insider's:
https://user-images.githubusercontent.com/29464607/205668325-407f3088-8e4c-4392-be51-43121c53b9ca.mov
is there a way to test that the switch is on?
This is not currently shipped with Insiders but you can do the following change and create a one-off insiders build,
- Replace the line with
this.issueReporterWindow.loadURL('chrome://accessibility') - Open the application and toggle the issue reporter window, you will now have the accessibility internals page from chromium that will display the various a11y states of a particular page.
I don't think that's a regression bc from my understanding, this detection was added last iteration
We did make voice over related detection changes last milestone but this iteration we changed how the a11y events are listened from the runtime and emitted to the application. Basically, Electron would trigger the event based on value change from the OS https://github.com/electron/electron/blob/909ee0ed6bbdf57ebaeda027b67a3a44185f6f7d/shell/browser/mac/electron_application.mm#L190 but the current change instead relies on Chromium to emit the event https://source.chromium.org/chromium/chromium/src/+/main:ui/accessibility/ax_mode_observer.h;l=17-18 . Chromium actually emits the event only after 2s since a11y client was turned off for reason mentioned in https://source.chromium.org/chromium/chromium/src/+/main:content/browser/accessibility/browser_accessibility_state_impl.cc;l=132-142, can you wait for that time period and check if that produces the off event.
It does not work when I wait even 10 seconds - I will try these steps next
This is not currently shipped with Insiders but you can do the following change and create a one-off insiders build,
Replace the line with this.issueReporterWindow.loadURL('chrome://accessibility') Open the application and toggle the issue reporter window, you will now have the accessibility internals page from chromium that will display the various a11y states of a particular page.
@deepak1556 it's showing screen reader: disabled and the tree looks wrong while it looks correct in oss

Thanks for testing, confirms a regression from the patch. I will address it this week, will update here once new builds are available.
@meganrogge the issue in the runtime https://github.com/microsoft/vscode/pull/167960#issuecomment-1336280543 is now addressed with https://github.com/microsoft/vscode/pull/170879. Do you want to pick up this PR again ? Thanks!
@deepak1556 thanks for the update - I just tested on macOS in the latest insider's and am not seeing it work when I turn voice over on or off. does it work for you?
Insiders with the above change has not been released yet, it will be available tomorrow PST :)
@meganrogge ping, latest insiders works fine with voiceover detection. Can you verify on your end, thanks!
@deepak1556 yes, it works for me now! thanks