mdn / mdn/content

Clarification of treegrid aria-readonly

Open
#23,496 7 comments 0 reactions 0 assignees View on GitHub
Content:Accessibility effort: medium help wanted
Dominant language
Markdown
Stars
11k
Forks
23.2k
Avg merge
2d 9h
Merged PRs (30d)
331

Description

### MDN URL

https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role

### What specific section or headline is this issue about?

#read-only_treegrids

### What information was incorrect, unhelpful, or incomplete?

The first two lines in the 'Read-only treegrids' section states:

> By default, treegrids are assumed to be editable. If a tree grid is not editable, use the [aria-readonly](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Attributes/aria-readonly) attribute to inform assistive technologies the treegrid is readonly.

So assuming I only presents information in a table (which has a tree structure) then is seems that I should add `aria-readonly="true"` to the `treegrid` root element.

But the WAI-ARIA documentation for [treegrid](https://w3c.github.io/aria/#treegrid) states

> When the [aria-readonly](https://w3c.github.io/aria/#aria-readonly) attribute is applied to a focusable [gridcell](https://w3c.github.io/aria/#gridcell), it indicates whether the content contained in the [gridcell](https://w3c.github.io/aria/#gridcell) is editable.

Which makes it seems that it should only be used for editable (or disabled editable) content. Further it states:

> In a treegrid that provides content editing functions, if the content of a focusable [gridcell](https://w3c.github.io/aria/#gridcell) element is not editable, authors MAY set [aria-readonly](https://w3c.github.io/aria/#aria-readonly) to true on the [gridcell](https://w3c.github.io/aria/#gridcell) element. However, if a treegrid presents a collection of elements that do not support [aria-readonly](https://w3c.github.io/aria/#aria-readonly), such as a collection of [link](https://w3c.github.io/aria/#link) elements, it is not necessary for the author to specify a value for [aria-readonly](https://w3c.github.io/aria/#aria-readonly).

Which seems to state that it should not be necessary to specify on a information only `treegrid`.

[WAI-ARIA Authoring Practices 1.2](https://w3c.github.io/aria-practices/#treegrid) states more specifically:

> If the treegrid provides content editing functionality and contains cells that may have edit capabilities disabled in certain conditions, [aria-readonly](https://w3c.github.io/aria/#aria-readonly) is set to true on cells where editing is disabled. If edit functions are disabled for all cells, instead of setting aria-readonly to true on every cell, aria-readonly may be set to true on the treegrid element. **Treegrids that do not provide cell content editing functions do not include the aria-readonly attribute on any of their elements.**

This seems to say that for information content only `aria-readonly` should not be used.

Can someone please clarify if the MDN documentation is misleading or if my interpretation of the WAI_ARIA is wrong.
Thanks

### What did you expect to see?

Not sure but an alignment with the WAI-ARIA

### Do you have any supporting links, references, or citations?

_No response_

### Do you have anything more you want to share?

_No response_

### MDN metadata

Page report details

* Folder: `en-us/web/accessibility/aria/roles/treegrid_role`
* MDN URL: https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/treegrid_role
* GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/accessibility/aria/roles/treegrid_role/index.md
* Last commit: https://github.com/mdn/content/commit/22203bf02a971f0325a079245501350cc3341edf
* Document last modified: 2022-09-25T08:53:03.000Z

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.