Skip to content
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

feat(roleHelpers): compute tree implicit arialevel #1088

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MatanBobi
Copy link
Member

@MatanBobi MatanBobi commented Jan 15, 2022

What: Adding the option to implicitly get the aria-level of a treeitem

Why: Resolves #980

How: At the moment, I'm using the naive approach and climb up the tree until I reach a node with explicit role tree.

This isn't ready yet, it's just a draft to see if this approach looks good.

Checklist:

  • Documentation added to the
    docs site
  • Tests
  • TypeScript definitions updated
  • Ready to be merged

@MatanBobi MatanBobi requested a review from eps1lon January 15, 2022 09:19
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit cd129b6:

Sandbox Source
react-testing-library-examples Configuration
react-testing-library aria-role tree Issue #980

@eps1lon
Copy link
Member

eps1lon commented Jan 15, 2022

Should I review this considering it's in draft and you said it's not ready yet?

@cmorten
Copy link

cmorten commented Mar 16, 2024

At the moment, I'm using the naive approach and climb up the tree until I reach a node with explicit role tree.

Some care needed here (if this is picked up again) as the implicit level (if I’m interpreting correctly) is not necessarily the depth in the DOM tree, but rather the depth in the accessibility tree from the parent node (including concepts such as aria-owns), though aria simply says "document structure" so maybe it’s ambiguous.

The core aam spec I think clarifies this: "If aria-level is not provided or inherited for an element of role treeitem or comment, user agents implementing IAccessible2 or ATK/AT-SPI MUST compute it by following the explicit or computed RELATION_NODE_CHILD_OF relations."

In the majority of cases this is likely equivalent, but there are patterns where application of role="presentation" or role="none" complicates things, e.g. see https://www.w3.org/WAI/ARIA/apg/patterns/treeview/examples/treeview-navigation/, or where using groups adds extra DOM hierarchy that need be ignored, e.g. see https://www.w3.org/WAI/ARIA/apg/patterns/treeview/examples/treeview-1a/

Adding the option to implicitly get the aria-level of a treeitem

Worth considering listitem, row (but only when in a treegrid), and comment (but only if want to support wai-aria 1.3 which is draft atm) for this as they too have implicit levels.

REF:


Update: on re-read of the implementation, I think this might be all ok (and my concerns r.e. nested already mitigated by the implementation), apologies should read properly first and comment later.

Comment r.e. other roles stands, and suspect would be good to add the more complex nesting examples as test cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add level filter for treeitem
3 participants