Closed
Bug 395909
Opened 17 years ago
Closed 17 years ago
Should not require namespaces for ARIA role usage in text/html
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
RESOLVED
FIXED
People
(Reporter: aaronlev, Assigned: aaronlev)
References
Details
(Keywords: access)
Attachments
(2 files, 4 obsolete files)
(deleted),
text/html
|
Details | |
(deleted),
patch
|
surkov
:
review+
damons
:
approval1.9+
|
Details | Diff | Splinter Review |
Most ARIA usage is actually occuring in text/html.
Because the namespace for a QName prefix cannot be defined, we require a fake prefix of "wairole:" before WAI role names. However, this is just 8 extra nonsense characters that don't mean anything, and simply makes ARIA more difficult to use.
It does not make sense to require a namespaced prefix for role use in text/html.
IOW we should allow:
role="menuitem" directly.
The old method of using role="wairole:menuitem" should still work.
Assignee | ||
Comment 1•17 years ago
|
||
Attachment #280606 -
Flags: review?(david.bolter)
Assignee | ||
Updated•17 years ago
|
Assignee | ||
Comment 2•17 years ago
|
||
Assignee | ||
Comment 3•17 years ago
|
||
Older testcases that still work with this patch:
1) http://www.mozilla.org/access/dhtml/checkbox -- xhtml
2) http://www.mozilla.org/access/dhtml/class/checkbox -- html, but uses fake "wairole:" prefix
Assignee | ||
Comment 4•17 years ago
|
||
Attachment #280606 -
Attachment is obsolete: true
Attachment #280610 -
Flags: review?(david.bolter)
Attachment #280606 -
Flags: review?(david.bolter)
Assignee | ||
Updated•17 years ago
|
Attachment #280610 -
Flags: review?(surkov.alexander)
Comment 5•17 years ago
|
||
Comment on attachment 280610 [details] [diff] [review]
Correct patch: 1) Clean up code to get or compare ARIA role for a given node, 2) Have it return role name w/o prefix if it is a WAI Role, 3) Optimize so that nsIDOM3Node is not QI'd to in text/html
>+ /**
>+ * Does the current content have this ARIA role?
>+ * @param aContent Node to get role string from
>+ * @param aRoleName Role string to compare with
>+ * @return PR_TRUE if there is a match
>+ */
>+ static PRBool ARIARoleEquals(nsIContent *aContent, char *aRoleName)
>+ { nsAutoString role; return GetARIARole(aContent, role) && role.EqualsLiteral("menu"); }
Why are we checking for literal "menu"? Maybe you mean't to check against aRoleName?
Assignee | ||
Comment 6•17 years ago
|
||
Attachment #280610 -
Attachment is obsolete: true
Attachment #280625 -
Flags: review?(david.bolter)
Attachment #280610 -
Flags: review?(surkov.alexander)
Attachment #280610 -
Flags: review?(david.bolter)
Assignee | ||
Updated•17 years ago
|
Attachment #280625 -
Flags: review?(surkov.alexander)
Assignee | ||
Updated•17 years ago
|
Attachment #280625 -
Attachment is obsolete: true
Attachment #280625 -
Flags: review?(surkov.alexander)
Attachment #280625 -
Flags: review?(david.bolter)
Assignee | ||
Comment 7•17 years ago
|
||
Attachment #280644 -
Flags: review?(david.bolter)
Assignee | ||
Comment 8•17 years ago
|
||
Comment on attachment 280644 [details] [diff] [review]
Fix ARIARoleEquals() -- good catch David Bolter -- preserve optimization (compile type calculation of const string length)
Also, to test new ARIARoleEquals() I used the following:
http://www.mozilla.org/access/dhtml/alert
and
http://www.mozilla.org/access/dhtml/spreadsheet (the menu)
Attachment #280644 -
Flags: review?(surkov.alexander)
Comment 9•17 years ago
|
||
Comment on attachment 280644 [details] [diff] [review]
Fix ARIARoleEquals() -- good catch David Bolter -- preserve optimization (compile type calculation of const string length)
Looks clean to me now. Will be nice to see this patch go in.
Attachment #280644 -
Flags: review?(david.bolter) → review+
Comment 10•17 years ago
|
||
Comment on attachment 280644 [details] [diff] [review]
Fix ARIARoleEquals() -- good catch David Bolter -- preserve optimization (compile type calculation of const string length)
> nsAutoString role;
>- if (nsAccessNode::GetRoleAttribute(content, role) &&
>- StringEndsWith(role, NS_LITERAL_STRING(":presentation")) &&
>- !content->IsFocusable()) {
>+ if (ARIARoleEquals(content, "presentation") && !content->IsFocusable()) {
you do not initialize role anymore but it is used at 1443 line.
Comment 11•17 years ago
|
||
Comment on attachment 280644 [details] [diff] [review]
Fix ARIARoleEquals() -- good catch David Bolter -- preserve optimization (compile type calculation of const string length)
>Index: accessible/src/base/nsAccessNode.h
>
>+#define ARIARoleEquals(aContent, aRoleName) \
>+ nsAccessNode::ARIARoleEqualsImpl(aContent, aRoleName, NS_ARRAY_LENGTH(aRoleName) - 1)
>+
possibly I would prefer to have special version of GetARIARole() to use it
GetARIARole(content).EqualsLiteral("menu");
or modification of your way (if it works :))
static PRBool ARIARoleEquals(nsIContent* aContent, const char* aRoleName)
>+ { nsAutoString role; return GetARIARole(aContent, role) && role.EqualsLiteral(aRoleName); }
Assignee | ||
Comment 12•17 years ago
|
||
> possibly I would prefer to have special version of GetARIARole() to use it
> GetARIARole(content).EqualsLiteral("menu");
You would have to create a global nsAutoString to store stuff in, right? That would make some of our |if| statements less readable. Also I would have to check .IsEmpty() in more places.
> or modification of your way (if it works :))
> static PRBool ARIARoleEquals(nsIContent* aContent, const char* aRoleName)
> >+ { nsAutoString role; return GetARIARole(aContent, role) && >
role.EqualsLiteral(aRoleName); }
That doesn't work, it doesn't compile, because EqualsLiteral() needs to be passed the actual string. That's why I did it as a macro.
Assignee | ||
Comment 13•17 years ago
|
||
Attachment #280644 -
Attachment is obsolete: true
Attachment #280728 -
Flags: review?(surkov.alexander)
Attachment #280644 -
Flags: review?(surkov.alexander)
Comment 14•17 years ago
|
||
(In reply to comment #12)
> > possibly I would prefer to have special version of GetARIARole() to use it
> > GetARIARole(content).EqualsLiteral("menu");
> You would have to create a global nsAutoString to store stuff in, right? That
> would make some of our |if| statements less readable. Also I would have to
> check .IsEmpty() in more places.
I thought about:
nsAString GetARIARole(nsIContent *aContent)
{
nsAutoString role;
GetARIARole(aContent, role);
return role;
}
GetARIARole(content).EqualsLiteral("menu");
Comment 15•17 years ago
|
||
Comment on attachment 280728 [details] [diff] [review]
Fix nsAccessibilityService() usage
r=me
Attachment #280728 -
Flags: review?(surkov.alexander)
Attachment #280728 -
Flags: review+
Attachment #280728 -
Flags: approval1.9?
Assignee | ||
Comment 16•17 years ago
|
||
re: comment 14, it would no longer be on the stack, so it's destroyed by the time you do the comparison.
Assignee | ||
Comment 17•17 years ago
|
||
Actually, I'm not sure about that.
Comment 18•17 years ago
|
||
I guess it should be ok but it brings unnecessary string copy.
Updated•17 years ago
|
Attachment #280728 -
Flags: approval1.9? → approval1.9+
Assignee | ||
Updated•17 years ago
|
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•