commit 41db1336ff7e5c1d03889c951087c69968aceb4a
parent fe39d493548b06d6d9a3d6c4cc0088ace1695b74
Author: Eitan Isaacson <eitan@monotonous.org>
Date: Sat, 15 Nov 2025 03:25:01 +0000
Bug 2000297 - Don't do role check in table caption getter. r=Jamie
Differential Revision: https://phabricator.services.mozilla.com/D272707
Diffstat:
3 files changed, 5 insertions(+), 14 deletions(-)
diff --git a/accessible/html/HTMLTableAccessible.cpp b/accessible/html/HTMLTableAccessible.cpp
@@ -397,16 +397,7 @@ Relation HTMLTableAccessible::RelationByType(RelationType aType) const {
LocalAccessible* HTMLTableAccessible::Caption() const {
LocalAccessible* child = mChildren.SafeElementAt(0, nullptr);
- // Since this is an HTML table the caption needs to be a caption
- // element with no ARIA role (except for a reduntant role='caption').
- // If we did a full Role() calculation here we risk getting into an infinite
- // loop where the parent role would depend on its name which would need to be
- // calculated by retrieving the caption (bug 1420773.)
- return child && child->NativeRole() == roles::CAPTION &&
- (!child->HasStrongARIARole() ||
- child->IsARIARole(nsGkAtoms::caption))
- ? child
- : nullptr;
+ return child && child->IsHTMLCaption() ? child : nullptr;
}
uint32_t HTMLTableAccessible::ColCount() const {
diff --git a/accessible/tests/browser/role/browser_roles_generic.js b/accessible/tests/browser/role/browser_roles_generic.js
@@ -237,8 +237,8 @@ addAccessibleTask(
testRole(getAcc("aria_region_empty_name_mixed"), ROLE_TEXT);
testRole(getAcc("aria_region_as_table_with_caption"), ROLE_REGION);
testRole(getAcc("aria_region_as_table_with_caption_mixed"), ROLE_REGION);
- testRole(getAcc("aria_region_as_table_with_miscaption"), ROLE_TABLE);
- testRole(getAcc("aria_region_as_table_with_miscaption_mixed"), ROLE_TABLE);
+ testRole(getAcc("aria_region_as_table_with_miscaption"), ROLE_REGION);
+ testRole(getAcc("aria_region_as_table_with_miscaption_mixed"), ROLE_REGION);
testRole(getAcc("aria_scrollbar"), ROLE_SCROLLBAR);
testRole(getAcc("aria_scrollbar_mixed"), ROLE_SCROLLBAR);
testRole(getAcc("aria_searchbox"), ROLE_SEARCHBOX);
diff --git a/accessible/tests/mochitest/role/test_aria.html b/accessible/tests/mochitest/role/test_aria.html
@@ -116,8 +116,8 @@
testRole("aria_region_empty_name_mixed", ROLE_TEXT);
testRole("aria_region_as_table_with_caption", ROLE_REGION);
testRole("aria_region_as_table_with_caption_mixed", ROLE_REGION);
- testRole("aria_region_as_table_with_miscaption", ROLE_TABLE);
- testRole("aria_region_as_table_with_miscaption_mixed", ROLE_TABLE);
+ testRole("aria_region_as_table_with_miscaption", ROLE_REGION);
+ testRole("aria_region_as_table_with_miscaption_mixed", ROLE_REGION);
testRole("aria_scrollbar", ROLE_SCROLLBAR);
testRole("aria_scrollbar_mixed", ROLE_SCROLLBAR);
testRole("aria_searchbox", ROLE_SEARCHBOX);