Skip to content

Commit 2d89f99

Browse files
committed
Bug 1956415 part 2: Disable native UIA when JAWS, other Vispero products or NVDA are detected. r=morgan
JAWS and NVDA will continue to use IA2 in Firefox. However, enabling native UIA in Gecko causes them both to try to use UIA, which causes breakage. The same is presumably true for other Vispero products, as they use components shared with JAWS. Future versions of these products will handle this correctly themselves. Until then, disable UIA when these products are detected. As part of this, the UIA pref has been changed from a bool to a uint32_t. This will cause existing configurations of this pref to be reset to the default, but this is okay because this pref has never been documented, exposed in the UI or intended for public usage. This allows for three values: 0 to never enable, 1 to always enable and 2 to enable unless incompatible clients are detected. This makes it possible for developers to test those clients with Gecko's UIA implementation when necessary. Differential Revision: https://phabricator.services.mozilla.com/D243245
1 parent bb1e959 commit 2d89f99

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

accessible/tests/browser/windows/uia/head.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ function addUiaTask(doc, task, options = {}) {
3838
function addTask(shouldEnable) {
3939
async function uiaTask(browser, docAcc, topDocAcc) {
4040
await SpecialPowers.pushPrefEnv({
41-
set: [["accessibility.uia.enable", shouldEnable]],
41+
set: [["accessibility.uia.enable", shouldEnable ? 2 : 0]],
4242
});
4343
gIsUiaEnabled = shouldEnable;
4444
info(shouldEnable ? "Gecko UIA enabled" : "Gecko UIA disabled");

accessible/windows/msaa/Compatibility.cpp

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,5 +218,16 @@ SuppressionReasons Compatibility::A11ySuppressionReasons() {
218218
/* static */
219219
bool Compatibility::IsUiaEnabled() {
220220
// This is the only function which should call the UIA pref function directly.
221-
return StaticPrefs::accessibility_uia_enable_DoNotUseDirectly();
221+
const uint32_t pref =
222+
StaticPrefs::accessibility_uia_enable_DoNotUseDirectly();
223+
if (pref == 0) {
224+
return false; // Never enable.
225+
}
226+
if (pref == 1) {
227+
return true; // Always enable.
228+
}
229+
// Bug 1956415: Some screen readers break when native UIA is enabled, so don't
230+
// enable it when they're detected.
231+
return !IsJAWS() && !IsOldJAWS() && !IsVisperoShared() &&
232+
!(sConsumers & NVDA);
222233
}

modules/libpref/init/StaticPrefList.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,13 @@
288288
#endif
289289
mirror: always
290290

291-
# Whether to enable support for the UI Automation API on Windows.
291+
# Whether to enable support for the UI Automation API on Windows. Values:
292+
# * 0: Never.
293+
# * 1: Always.
294+
# * 2: Enable unless incompatible accessibility clients are detected.
292295
- name: accessibility.uia.enable
293-
type: bool
294-
value: false
296+
type: uint32_t
297+
value: 0
295298
mirror: always
296299
do_not_use_directly: true
297300

0 commit comments

Comments
 (0)