Fire a11y event on touch screens using screen readers
This commit is contained in:
parent
cbe9768529
commit
9c9ba80978
1 changed files with 11 additions and 6 deletions
|
@ -72,6 +72,12 @@ const char* AppCommandToString(int command_id) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool IsScreenReaderActive() {
|
||||||
|
UINT screenReader = 0;
|
||||||
|
SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenReader, 0);
|
||||||
|
return screenReader && UiaClientsAreListening();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
|
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
|
||||||
|
@ -91,21 +97,20 @@ bool NativeWindowViews::PreHandleMSG(
|
||||||
// because we still want Chromium to handle returning the actual
|
// because we still want Chromium to handle returning the actual
|
||||||
// accessibility object.
|
// accessibility object.
|
||||||
case WM_GETOBJECT: {
|
case WM_GETOBJECT: {
|
||||||
|
if (checked_for_a11y_support_) return false;
|
||||||
|
|
||||||
const DWORD obj_id = static_cast<DWORD>(l_param);
|
const DWORD obj_id = static_cast<DWORD>(l_param);
|
||||||
|
|
||||||
if (obj_id != OBJID_CLIENT) {
|
if (obj_id != OBJID_CLIENT) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (checked_for_a11y_support_) return false;
|
if (!IsScreenReaderActive()) {
|
||||||
checked_for_a11y_support_ = true;
|
|
||||||
|
|
||||||
UINT screenReader = 0;
|
|
||||||
SystemParametersInfo(SPI_GETSCREENREADER, 0, &screenReader, 0);
|
|
||||||
if (!screenReader || !UiaClientsAreListening()) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checked_for_a11y_support_ = true;
|
||||||
|
|
||||||
const auto axState = content::BrowserAccessibilityState::GetInstance();
|
const auto axState = content::BrowserAccessibilityState::GetInstance();
|
||||||
if (axState && !axState->IsAccessibleBrowser()) {
|
if (axState && !axState->IsAccessibleBrowser()) {
|
||||||
axState->OnScreenReaderDetected();
|
axState->OnScreenReaderDetected();
|
||||||
|
|
Loading…
Reference in a new issue