commit 376d5c66dc967fc0fbe869d41bb2509543e16e7b
parent 5bd8277cfe35be4c2eed9bf3fc3ff6228da29062
Author: Eitan Isaacson <eitan@monotonous.org>
Date: Tue, 18 Nov 2025 18:13:45 +0000
Bug 2000098 - P4: Introduce another whimsy test of aria-labels. r=morgan
Differential Revision: https://phabricator.services.mozilla.com/D272549
Diffstat:
1 file changed, 24 insertions(+), 0 deletions(-)
diff --git a/accessible/tests/browser/name_and_description/browser_name_general.js b/accessible/tests/browser/name_and_description/browser_name_general.js
@@ -253,3 +253,27 @@ addAccessibleTask(
},
{ topLevel: true, chrome: true }
);
+
+/*
+ * Test labels that use ARIA naming in different ways.
+ */
+addAccessibleTask(
+ `<div id="label1">bye <a href="#" aria-labelledby="btn1">world</a></div>
+ <button aria-labelledby="label1" id="btn1">hello</button>
+ <div id="label2">bye <a href="#" aria-label="mars">world</a></div>
+ <button aria-labelledby="label2" id="btn2">hello</button>
+ <div id="label3" aria-label="mars">bye</div>
+ <button aria-labelledby="label3" id="btn3">hello</button>`,
+ async function testSomeInterestingLabels(browser, docAcc) {
+ const btn1 = findAccessibleChildByID(docAcc, "btn1");
+ const btn2 = findAccessibleChildByID(docAcc, "btn2");
+ const btn3 = findAccessibleChildByID(docAcc, "btn3");
+ // A button whose label subtree references the button
+ testName(btn1, "bye world");
+ // A button whose label subtree has an explicit aria-label
+ testName(btn2, "bye mars");
+ // A button whose label has an explicit aria-label of its own
+ testName(btn3, "mars");
+ },
+ { topLevel: true, chrome: true }
+);