mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-10-29 23:46:02 +02:00
Bug 1971642: When falling back to the next valid ARIA role, use a case insensitive comparison when skipping roles. a=dmeehan
We assume ARIA roles are case insensitive when setting up the role map entry. In contrast, previously, when falling back to the next valid role due to the criteria for an earlier role not being met, we were using a case sensitive comparison. This resulted in infinite recursion when an invalid role contained upper case characters because we kept trying to process the ARIA role we were already processing. To fix this, use a case sensitive comparison here, making it consistent with other ARIA role checks. Original Revision: https://phabricator.services.mozilla.com/D253617 Differential Revision: https://phabricator.services.mozilla.com/D253753
This commit is contained in:
parent
9ac4e9c5d2
commit
1aaafd8cdc
2 changed files with 9 additions and 1 deletions
|
|
@ -1519,7 +1519,8 @@ uint8_t aria::GetFirstValidRoleMapIndexExcluding(
|
|||
// Skip any roles that we aren't interested in.
|
||||
bool shouldSkip = false;
|
||||
for (nsStaticAtom* atomRole : aRolesToSkip) {
|
||||
if (role.Equals(atomRole->GetUTF16String())) {
|
||||
if (role.Equals(atomRole->GetUTF16String(),
|
||||
nsCaseInsensitiveStringComparator)) {
|
||||
shouldSkip = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ addAccessibleTask(
|
|||
</div>
|
||||
<div id="ariaSearchbox" role="searchbox">ARIA searchbox</div>
|
||||
<div id="ariaUnknown" role="unknown">unknown ARIA role</div>
|
||||
<div id="ariaFallbackUpperCase" role="REGION GROUP">unlabelled region with fallback to group, upper case</div>
|
||||
<button id="htmlButton">HTML button</button>
|
||||
<button id="toggleButton" aria-pressed="true">toggle button</button>
|
||||
<main id="htmlMain">HTML main</main>
|
||||
|
|
@ -61,6 +62,12 @@ addAccessibleTask(
|
|||
testComputedARIARole("ariaRowgroup", "rowgroup");
|
||||
testComputedARIARole("ariaSearchbox", "searchbox");
|
||||
testComputedARIARole("ariaUnknown", "generic");
|
||||
// XXX Ideally, ariaFallbackUpperCase would be tested in
|
||||
// testing/web-platform/tests/wai-aria/role/fallback-roles.html
|
||||
// However, it's unclear in the spec whether ARIA roles are intended to be
|
||||
// case insensitive or not, so we can't reasonably assume that in WPT until
|
||||
// that's cleared up. See https://github.com/w3c/aria/issues/2548.
|
||||
testComputedARIARole("ariaFallbackUpperCase", "group");
|
||||
testComputedARIARole("htmlButton", "button");
|
||||
// There is only a single ARIA role for buttons, but Gecko uses different
|
||||
// roles depending on states.
|
||||
|
|
|
|||
Loading…
Reference in a new issue