Merge pull request #5056 from electron/fix-a11y-reader
Fix NVDA/JAWS support in Electron
This commit is contained in:
commit
adb112e970
2 changed files with 23 additions and 0 deletions
|
@ -199,6 +199,10 @@ class NativeWindowViews : public NativeWindow,
|
||||||
|
|
||||||
// In charge of running taskbar related APIs.
|
// In charge of running taskbar related APIs.
|
||||||
TaskbarHost taskbar_host_;
|
TaskbarHost taskbar_host_;
|
||||||
|
|
||||||
|
// If true we have enabled a11y
|
||||||
|
bool enabled_a11y_support_;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Handles unhandled keyboard messages coming back from the renderer process.
|
// Handles unhandled keyboard messages coming back from the renderer process.
|
||||||
|
|
|
@ -84,6 +84,25 @@ bool NativeWindowViews::PreHandleMSG(
|
||||||
NotifyWindowMessage(message, w_param, l_param);
|
NotifyWindowMessage(message, w_param, l_param);
|
||||||
|
|
||||||
switch (message) {
|
switch (message) {
|
||||||
|
// Screen readers send WM_GETOBJECT in order to get the accessibility
|
||||||
|
// object, so take this opportunity to push Chromium into accessible
|
||||||
|
// mode if it isn't already, always say we didn't handle the message
|
||||||
|
// because we still want Chromium to handle returning the actual
|
||||||
|
// accessibility object.
|
||||||
|
case WM_GETOBJECT: {
|
||||||
|
const DWORD obj_id = static_cast<DWORD>(l_param);
|
||||||
|
if (enabled_a11y_support_) return false;
|
||||||
|
|
||||||
|
if (obj_id == OBJID_CLIENT) {
|
||||||
|
const auto axState = content::BrowserAccessibilityState::GetInstance();
|
||||||
|
if (axState && !axState->IsAccessibleBrowser()) {
|
||||||
|
axState->OnScreenReaderDetected();
|
||||||
|
enabled_a11y_support_ = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
case WM_COMMAND:
|
case WM_COMMAND:
|
||||||
// Handle thumbar button click message.
|
// Handle thumbar button click message.
|
||||||
if (HIWORD(w_param) == THBN_CLICKED)
|
if (HIWORD(w_param) == THBN_CLICKED)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue