New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(material/tree): Apply aria-level to all nodes #17818
Conversation
I've tested this manually via the demos on http://localhost:4200/tree, but I'm having trouble finding the unit tests to update. |
90ef883
to
ad2973e
Compare
Thank you! 🤦♂️ I was looking for files ending in _test.ts and my eyes went right past the .spec.ts files. I located the related tests, but it appears like all of the nodes were already leaf nodes (only leaf nodes have role="treeitem"), so the current set of test changes did pass before the changes to mat-tree/cdk-tree were applied. I haven't looked into modifying the dataset to have a deeper tree yet (and I'm not sure that kind of change belongs in this commit) -- thoughts? [EDIT: it looks like adding items to the tree is really easy, so I think I'll just do that in this PR.] EDIT: It appears that, as demonstrated by the CdkTree tests, that client code has control over what the level of the nodes are. Since the specific value is not relevant to this change, I just changed the assertions to match the level specified by the data object, but that concerns me slightly in that the next change I have queued up involves making the leveling start at 0 instead of 1. |
ad2973e
to
f3a6625
Compare
Definitely an oversight that there aren't any existing |
3cf38db
to
04cc369
Compare
Thanks! Currently I still need to clean up an unrelated change and also figure out why the mat-tree version of the test is failing, so not quite ready for review. |
I think I may have found a bug in the flat tree tests:
I need some help figuring out what to do to get the nodes into the DOM (would have guessed detectChanges would have been doing that). Once that gets figured out, I'll fix the tests that were broken by adding the tree length assertion and put that into a separate CL (unless the owners prefer it in this one). |
312471c
to
11ae3ce
Compare
Hey, I somehow missed the notification on this PR; sorry for the super delayed response. I took a look your test issue. You're correctly adding a new child node, but its parent is marked as collapsed, so the new node isn't rendering. You can fix it by adding This definitely wasn't obvious- it took me like 10 minutes to realize what was happening. |
36321bd
to
b0d9885
Compare
Aha, thank you! I think everything passes now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Do I need to take any actions to merge this? |
I bumped the priority on this in our merge queue- it looks like it got overlooked due to being older |
From a quick glance it seems like the bindings should just all be |
@martiansnoop We can try to get this in - did you get a chance to see the message about |
@annieyw added a commit to this PR to update the level to start at one. LGTM for new changes. |
Previously, only leaf nodes had aria-level applied. This is an incremental change since this is an unfamiliar codebase for me. The main benefit it will have on its own is that it will allow anyone doing custom dom manipulation to know what level the node is on. Otherwise by itself there is no change in how NVDA reads nodes with children. (It currently reads them as literally "grouping"; no information about the contents is provided). This change will be necessary for a later change I'm planning, wherein the role of parent nodes will be changed from "group" to "treeitem", in accordance with how roles are applied in WAI-ARIA reference examples such as https://www.w3.org/TR/wai-aria-practices/examples/treeview/treeview-1/treeview-1b.html
def2a1b
to
018dd3b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* fix(material/tree): Apply aria-level to all nodes Previously, only leaf nodes had aria-level applied. This is an incremental change since this is an unfamiliar codebase for me. The main benefit it will have on its own is that it will allow anyone doing custom dom manipulation to know what level the node is on. Otherwise by itself there is no change in how NVDA reads nodes with children. (It currently reads them as literally "grouping"; no information about the contents is provided). This change will be necessary for a later change I'm planning, wherein the role of parent nodes will be changed from "group" to "treeitem", in accordance with how roles are applied in WAI-ARIA reference examples such as https://www.w3.org/TR/wai-aria-practices/examples/treeview/treeview-1/treeview-1b.html * change aria-level binding to one-based * change role to treeitem * always set role to treeitem * simplify logic for setting role * add follow up TODO to makr role as deprecated Co-authored-by: Annie Wang <annieyw@google.com> (cherry picked from commit aeb6f89)
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Previously, only leaf nodes had aria-level applied.
This is an incremental change since this is an unfamiliar codebase for
me. The main benefit it will have on its own is that it will allow
anyone doing custom dom manipulation to know what level the node is on.
Otherwise by itself there is no change in how NVDA reads nodes with
children. (It currently reads them as literally "grouping"; no
information about the contents is provided).
This change will be necessary for a later change I'm planning, wherein
the role of parent nodes will be changed from "group" to "treeitem", in
accordance with how roles are applied in WAI-ARIA reference examples
such as
https://www.w3.org/TR/wai-aria-practices/examples/treeview/treeview-1/treeview-1b.html