vscode
vscode copied to clipboard
set accessibility mode on reload of window
fixes https://github.com/microsoft/vscode/issues/167583
Blocked by the chromium fix but works in OSS
Blocked by the chromium fix but works in OSS
Is this referring to https://github.com/microsoft/vscode/pull/167960#issuecomment-1338639913 ? That would be only for macOS.
Oh ok great then this should be good to review and merge
open is called in places where app refers to CodeApplication and thus does not have an isAccessibilitySupportEnabled function to call
I'm not familiar with this code - would you recommend I save the value of that before this https://github.com/microsoft/vscode/blob/71cd323fa9d0dffa881490f49b5c53ce9ba6fef2/src/vs/code/electron-main/app.ts#L870
happens and pass that in to all of the open calls?
@meganrogge windowImpl is still in electron-main and has access to Electron app module, see for example:
https://github.com/microsoft/vscode/blob/b92894493e6f971a3c71912d823e699d3a05d643/src/vs/platform/windows/electron-main/windowImpl.ts#L485
Same goes for windowsMainService if we want to put this into the config.
Bottom line: instead of sending an IPC message to the window, I would send this information to the window as part of the config when opening.
it turns out, we're already passing that in as an option, but not updating the accessibility service on reload
https://github.com/microsoft/vscode/blob/a3dd458dc0e92eccee2390bba81615386447a8d3/src/vs/platform/windows/electron-main/windowsMainService.ts#L1380
@meganrogge there is a way to update the configuration explicitly when doing a window reload, see here:
https://github.com/microsoft/vscode/blob/422b581e3802e30cfb780c21d9cc1a2cd0c9f0aa/src/vs/platform/windows/electron-main/windowImpl.ts#L1043
For example we update some properties here:
https://github.com/microsoft/vscode/blob/422b581e3802e30cfb780c21d9cc1a2cd0c9f0aa/src/vs/platform/windows/electron-main/windowImpl.ts#L1069-L1070
I would think we can set accessibility mode too.
@bpasero Thanks for the code pointers and continued discussion.
Based on logging, the values on environmentService.window do not get updated on reload and I don't think that's possible
It seems that consumers of INativeWorkbenchEnvironmentService end up using the storage service for this case instead
For example: https://github.com/microsoft/vscode/blob/60bbd421a19e0443852712a8c74ce056a225e59a/src/vs/workbench/services/themes/electron-sandbox/nativeHostColorSchemeService.ts#L28-L59
When I open a window, the property is known. When I changed the theme to light and reloaded, logging the value of the theme shows that it was not correct (thus the necessity of the storage service)

@meganrogge theming might do something very special for other reasons, do not take it as an example. The values of the environment service will be updated based on the main side configuration from the reload call, can you try it?
I tried that and the value was undefined - perhaps because of a timing issue?
I noticed continueOn also uses the storage service and policiesData is used in initServices - which we can't do for the accessibilityService
@meganrogge a simple example works for me, here are my changes:
configuration.verbose = true;
In constructor of window.ts:
console.log(this.environmentService.verbose);
On first start I get false and on reload true.
It does appear to be working for me now
Oh I had my old changes still, hopefully it will work when I remove them as well
Think I see what's wrong though
@bpasero it was already on INativeWindowConfiguration
that already happens here
https://github.com/microsoft/vscode/blob/84b9f9386aa15a6f4af12d570648dcdf767660d3/src/vs/workbench/services/accessibility/electron-sandbox/accessibilityService.ts#L44
Thanks for the help @bpasero 👍🏼