commit 9dca043ff9b16615fa56160924c7681804af6f75
parent 7b05d06773aeb756d37bc7d22f95543dc4104281
Author: James Teh <jteh@mozilla.com>
Date: Tue, 16 Dec 2025 22:44:23 +0000
Bug 1994032 part 3: Expose hasactions as part of the UIA AriaProperties property. r=eeejay
Differential Revision: https://phabricator.services.mozilla.com/D276601
Diffstat:
2 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/accessible/tests/browser/windows/uia/browser_relationProps.js b/accessible/tests/browser/windows/uia/browser_relationProps.js
@@ -174,3 +174,44 @@ addUiaTask(
// The IA2 -> UIA proxy doesn't support AccessibleActions.
{ uiaEnabled: true, uiaDisabled: false }
);
+
+/**
+ * Test exposure of AriaProperties.hasactions.
+ */
+addUiaTask(
+ `
+<button id="button">button</button>
+<div role="tablist">
+ <div id="tab1" role="tab" tabindex="0" aria-actions="tab1Button">
+ tab1
+ <button id="tab1Button">tab1Button</button>
+ </div>
+ <div id="tab2" role="tab" aria-actions="tab2Button">
+ tab2
+ <button id="tab2Button" hidden>tab2Button</button>
+ </div>
+</div>
+ `,
+ async function testHasActions() {
+ await definePyVar("doc", `getDocUia()`);
+ is(
+ await runPython(`findUiaByDomId(doc, "button").CurrentAriaProperties`),
+ "",
+ "button missing hasactions"
+ );
+ // tab1 has a visible action.
+ is(
+ await runPython(`findUiaByDomId(doc, "tab1").CurrentAriaProperties`),
+ "hasactions=true",
+ "tab1 hasactions=true"
+ );
+ // tab2 has an action, but it's hidden.
+ is(
+ await runPython(`findUiaByDomId(doc, "tab2").CurrentAriaProperties`),
+ "hasactions=true",
+ "tab2 hasactions=true"
+ );
+ },
+ // The IA2 -> UIA proxy doesn't support hasactions.
+ { uiaEnabled: true, uiaDisabled: false }
+);
diff --git a/accessible/windows/uia/uiaRawElmProvider.cpp b/accessible/windows/uia/uiaRawElmProvider.cpp
@@ -596,6 +596,12 @@ uiaRawElmProvider::GetPropertyValue(PROPERTYID aPropertyId,
ariaProperties.AppendLiteral("atomic=false");
}
}
+ if (acc->HasCustomActions()) {
+ if (!ariaProperties.IsEmpty()) {
+ ariaProperties += ';';
+ }
+ ariaProperties.AppendLiteral("hasactions=true");
+ }
if (!ariaProperties.IsEmpty()) {
aPropertyValue->vt = VT_BSTR;
aPropertyValue->bstrVal = ::SysAllocString(ariaProperties.get());