Closed Bug 1407167 Opened 8 years ago Closed 5 years ago

aria ROLE values are case sensitive

Categories

(Core :: Disability Access APIs, defect, P5)

57 Branch
Unspecified
Windows
defect

Tracking

()

RESOLVED FIXED
88 Branch
Webcompat Priority revisit
Tracking Status
firefox88 --- fixed

People

(Reporter: faulkner.steve, Assigned: marcos, Mentored)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Go to https://s.codepen.io/stevef/debug/YrLwwE check the role name exposed in Ia2 for the first role="BUTton". should be 'push button' actual is text frame. IE/Edge/Safari treat role values as ASCII case insensitive, firefox does not. Suggest that firefox should.
Flags: webcompat+
Version: unspecified → 57 Branch
OUCH! This is a really silly bug, since all other attribute values in HTML are of course case-insensitive, too. Alex, where is this being checked? We need to fix this ASAP.
Flags: needinfo?(surkov.alexander)
Core AAM seems to agree as HTML is case-insensitive language, C item states [1]: "Do a comparison of the substrings to all the names of the non-abstract WAI-ARIA roles. Case-sensitivity of the comparison inherits from the case-sensitivity of the host language." Marco, what does it make you think this is a high priority bug? It rather feels as an edge case that'd be good to handle. I'm assigning it to p5 for the first pass, but please feel free to bump it. Also I'm not sure whether there's a point of ARIA to inherit case-sensitivity rules from a host language. We probably should ask ARIA group for clarification before jumping into fixing the bug. https://www.w3.org/TR/core-aam-1.1/#roleMappingGeneralRules
Blocks: aria
Flags: needinfo?(surkov.alexander)
Priority: -- → P5

See bug 1547409. Moving webcompat whiteboard tags to project flags.

Webcompat Priority: --- → ?
Webcompat Priority: ? → revisit
Flags: webcompat+

Just noting that Chrome and Safari treat the assigning the roles as case insensitive, so this/remains is a potential web combat issue.

I think https://searchfox.org/mozilla-central/source/accessible/base/ARIAMap.cpp#1383 is what needs to change... the comparator is case sensitive there. Either the constructor should lcase mRole or maybe there is some Compare() function that can do the case comparison. I couldn't work out what namespace Compare() is being called from (and neither could searchfox), so I could figure out what a quick fix might be.

Does anyone know? If someone can guide me I can try to fix this.

Yuck. I think we're using this non-namespaced Compare function. I don't even understand why that exists.

I would just change that line to this (I haven't tested though):

return mRole.Compare(aEntry.ARIARoleString(), /* aIgnoreCase */ true);

Note that while this bug is (currently) just about ARIA roles, there are quite a few other places where ARIA attribute values are expected to be lower case; true, false, etc. That should mostly be a matter of changing instances of eCaseMatters to eIgnoreCase, but there may be some which shouldn't be changed, so each will need to be examined.

(In reply to James Teh [:Jamie] from comment #6)

return mRole.Compare(aEntry.ARIARoleString(), /* aIgnoreCase */ true);

Hehe, I actually tried that yesterday. For whatever reason, the nsDependentSubstring class doesn't have a .Compare() method. That's where I got stuck... Gecko strings are always a bit of a challenge.

Note that while this bug is (currently) just about ARIA roles, there are quite a few other places where ARIA attribute values are expected to be lower case; true, false, etc. That should mostly be a matter of changing instances of eCaseMatters to eIgnoreCase, but there may be some which shouldn't be changed, so each will need to be examined.

Yeah, absolutely.

Blah. Maybe this?

#include "nsUnicharUtils.h"
...
return Compare(mRole, aEntry.ARIARoleString(), nsCaseInsensitiveStringComparator);

Nice one, Jamie! Worked a treat! I'll hunt around for tests and draft up a patch.

accessible/tests/mochitest/role/aria.html is probably a reasonable place for role tests.

Mentor: jteh
Assignee: nobody → marcos
Status: NEW → ASSIGNED
Pushed by marcos@marcosc.com: https://hg.mozilla.org/integration/autoland/rev/da103fff9e7e Make ARIA in HTML mapping case insensitive r=Jamie
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → 88 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: