Closed
Bug 429285
Opened 16 years ago
Closed 16 years ago
Propagate aria-disabled to descendants
Categories
(Core :: Disability Access APIs, defect)
Core
Disability Access APIs
Tracking
()
VERIFIED
FIXED
mozilla1.9.1a1
People
(Reporter: aaronlev, Assigned: aaronlev)
References
(Blocks 1 open bug)
Details
(Keywords: access, Whiteboard: post1.9[has-patch,has-review])
Attachments
(3 files, 5 obsolete files)
2.84 KB,
patch
|
surkov
:
review+
|
Details | Diff | Splinter Review |
393 bytes,
text/html
|
Details | |
6.28 KB,
patch
|
surkov
:
review+
|
Details | Diff | Splinter Review |
The PF group resolved that aria-disabled be propagated to descendants.
Assignee | ||
Comment 1•16 years ago
|
||
Attachment #315952 -
Flags: review?(surkov.alexander)
Assignee | ||
Comment 2•16 years ago
|
||
Comment 3•16 years ago
|
||
Comment on attachment 315952 [details] [diff] [review] Check parent chain of focusable items for aria-disabled. I kept it in the universal property map so that the current element is checked even if it is not focusable. > while ((ancestorContent = ancestorContent->GetParent()) != nsnull) { >- if (ancestorContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::aria_activedescendant)) { >- // ancestor has activedescendant property, this content could be active >- *aState |= nsIAccessibleStates::STATE_FOCUSABLE; >+ if (ancestorContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::aria_disabled, >+ nsAccessibilityAtoms::_true, eCaseMatters)) { >+ // ancestor has aria-disabled property, this is disabled nit: please align it >+ *aState |= nsIAccessibleStates::STATE_UNAVAILABLE; > break; > }
Attachment #315952 -
Flags: review?(surkov.alexander)
Attachment #315952 -
Flags: review+
Attachment #315952 -
Flags: approval1.9?
Comment 5•16 years ago
|
||
(In reply to comment #4) > needed mochitest for this Yep I am planning to convert Aaron's testcase into a mochitest.
Assignee | ||
Comment 6•16 years ago
|
||
Comment on attachment 315952 [details] [diff] [review] Check parent chain of focusable items for aria-disabled. I kept it in the universal property map so that the current element is checked even if it is not focusable. We don't absolutely have to have this for 1.9.
Attachment #315952 -
Flags: approval1.9?
Updated•16 years ago
|
Whiteboard: post1.9
Updated•16 years ago
|
Whiteboard: post1.9 → post1.9[has-patch,has-review]
Comment 7•16 years ago
|
||
Mochitest based on Aaron's testcase.
Attachment #324614 -
Flags: review?(surkov.alexander)
Comment 8•16 years ago
|
||
Comment on attachment 324614 [details] [diff] [review] Mochitest >+ function testChildren(aID, aAcc) >+ { >+ // Iterate over its children to see if they are disabled, too. >+ var children = null; >+ try { >+ children = aAcc.children; >+ } catch(e) {} >+ ok(children, "Could not get children for " + aID +"!"); >+ >+ if (children) { >+ // Iterate over the children to see if they are disabled, too. >+ for (var i=0; i<children.length; i++) { >+ var childAcc = children.queryElementAt(i, nsIAccessible); >+ var role = childAcc.finalRole; >+ if (role != nsIAccessibleRole.ROLE_TEXT_LEAF) { >+ testDisabled(childAcc.name, childAcc); >+ } >+ >+ // If it's the listbox, iterate over its children as well. >+ if (role = nsIAccessibleRole.ROLE_LIST) { >+ testChildren("list", childAcc); >+ } the rule is any focusable descendant looks for aria-disabled through parents. Why do you like to consider specific cases instead?
Comment 9•16 years ago
|
||
(In reply to comment #8) > the rule is any focusable descendant looks for aria-disabled through parents. > Why do you like to consider specific cases instead? Because the text leafs aren't focusable. And, I want to make sure that every focusable item does indeed pick up the "disabled" state from the parent chain.
Comment 10•16 years ago
|
||
Marco, I mean you could write general code: run through the tree, pick up focusable accessibles and check disabled state. I think I would like it more than check of specific cases.
Comment 11•16 years ago
|
||
This Mercurial patch contains everything including Aaron's already reviewed code patch. In the testChildren function, I iterate over any possible children if the accessible is not of role text_leaf. Is this what you had in mind, Alex?
Attachment #324614 -
Attachment is obsolete: true
Attachment #324932 -
Flags: review?(surkov.alexander)
Attachment #324614 -
Flags: review?(surkov.alexander)
Comment 12•16 years ago
|
||
Comment on attachment 324932 [details] [diff] [review] Mercurial patch with Surkov's comment addressed >+ function testDisabled(aID, aAcc) >+ { >+ // Mapping needed state flags for easier handling. >+ const state_disabled = >+ Components.interfaces.nsIAccessibleStates.STATE_UNAVAILABLE; >+ var state = {}, extraState = {}; >+ aAcc.getFinalState(state, extraState); >+ is(state.value & state_disabled, state_disabled, >+ "Wrong disabled state bit for " + aID + "!"); >+ } >+ >+ function testChildren(aID, aAcc) >+ { >+ // Iterate over its children to see if they are disabled, too. >+ var children = null; >+ try { >+ children = aAcc.children; >+ } catch(e) {} >+ ok(children, "Could not get children for " + aID +"!"); >+ >+ if (children) { >+ // Iterate over the children to see if they are disabled, too. >+ for (var i=0; i<children.length; i++) { >+ var childAcc = children.queryElementAt(i, nsIAccessible); >+ var role = childAcc.finalRole; >+ if (role != nsIAccessibleRole.ROLE_TEXT_LEAF) { I would suggest to not check the role, please check focusable state. It should be enough. >+ >+ if (groupAcc) { >+ // Check state of group first. >+ testDisabled("group", groupAcc); >+ testChildren("group", groupAcc); it's better to put testDisabled into testChildren function.
Comment 13•16 years ago
|
||
Removed testDisabled function. It's no longer called more than once, so folded it into testChildren. Also testing for focusable state now instead of role of text leaf.
Attachment #324932 -
Attachment is obsolete: true
Attachment #324946 -
Flags: review?(surkov.alexander)
Attachment #324932 -
Flags: review?(surkov.alexander)
Comment 14•16 years ago
|
||
Good, one thing: you call getFinalState() twice for the same accessible ;)
Comment 15•16 years ago
|
||
(In reply to comment #14) > Good, one thing: you call getFinalState() twice for the same accessible ;) OK, the only way I can see to fix that is to introduce another parameter to the function, call getFinalState on the group element before going into the function first, and then only call it again for the current child within the for loop. Is that acceptable?
Comment 16•16 years ago
|
||
Comment on attachment 324946 [details] [diff] [review] Address Sukov's comments possibly like this? What do you think? >+ function testChildren(aID, aAcc) >+ { >+ // Mapping needed state flags for easier handling. >+ const state_disabled = >+ Components.interfaces.nsIAccessibleStates.STATE_UNAVAILABLE; >+ const state_focusable = >+ Components.interfaces.nsIAccessibleStates.STATE_FOCUSABLE; >+ >+ // Check state of aAcc first. >+ var state = {}, extraState = {}; >+ aAcc.getFinalState(state, extraState); if (state.value & state_focused) { >+ is(state.value & state_disabled, state_disabled, >+ "Wrong disabled state bit for " + aID + "!"); >+ } >+ // Iterate over its children to see if they are disabled, too. >+ var children = null; >+ try { >+ children = aAcc.children; >+ } catch(e) {} >+ ok(children, "Could not get children for " + aID +"!"); >+ >+ if (children) { >+ for (var i=0; i<children.length; i++) { >+ var childAcc = children.queryElementAt(i, nsIAccessible); >+ // Test and recurse over its children as well. >+ testChildren(childAcc.name, childAcc); >+ } >+ } >+ } >+ >+ function doTest() >+ { >+ gAccRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"]. >+ getService(nsIAccessibleRetrieval); >+ >+ var groupItem = document.getElementById("group"); >+ var groupAcc = null; >+ try { >+ groupAcc = gAccRetrieval.getAccessibleFor(groupItem); >+ } catch (e) {} >+ ok (groupAcc, >+ "No accessible for group element!"); >+ >+ if (groupAcc) { var state = {}, extraState = {}; groupAcc.getFinalState(state, extraState); is(state.value & state_disabled, state_disabled, "Wrong disabled state bit for " + aID + "!"); >+ testChildren("group", groupAcc); >+ } >+ SimpleTest.finish(); >+ }
Comment 17•16 years ago
|
||
That will test the disabled state of the group accessible twice.
Comment 18•16 years ago
|
||
Attachment #324946 -
Attachment is obsolete: true
Attachment #325087 -
Flags: review?(surkov.alexander)
Attachment #324946 -
Flags: review?(surkov.alexander)
Comment 19•16 years ago
|
||
(In reply to comment #17) > That will test the disabled state of the group accessible twice. > Not exactly, It will get state for the group twice but won't test disabled state twice :) but your case won't work if focusable children are contained by not focusable accessible.
Comment 20•16 years ago
|
||
This should address your comment, but still call getFinalState only once for each accessible.
Attachment #325087 -
Attachment is obsolete: true
Attachment #325091 -
Flags: review?(surkov.alexander)
Attachment #325087 -
Flags: review?(surkov.alexander)
Comment 21•16 years ago
|
||
Looks like your way was the correct one after all, Alex. It appears to be unavoidable to call getFinalState on the group accessible twice.
Attachment #325091 -
Attachment is obsolete: true
Attachment #325147 -
Flags: review?(surkov.alexander)
Attachment #325091 -
Flags: review?(surkov.alexander)
Comment 22•16 years ago
|
||
Comment on attachment 325147 [details] [diff] [review] Fix not checking state for group. r=me, thank you.
Attachment #325147 -
Flags: review?(surkov.alexander) → review+
Comment 23•16 years ago
|
||
Fixed in changeset: http://hg.mozilla.org/mozilla-central/index.cgi/rev/583509de7d02
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Updated•16 years ago
|
Flags: in-testsuite? → in-testsuite+
Comment 24•16 years ago
|
||
Verified fixed in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1a1pre) Gecko/2008062603 Minefield/3.1a1pre
Status: RESOLVED → VERIFIED
Updated•16 years ago
|
Target Milestone: --- → mozilla1.9.1a1
You need to log in
before you can comment on or make changes to this bug.
Description
•