A11yance / aria-query

Programmatic access to the ARIA specification

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Missing `title` attribute for region role

Sawtaytoes opened this issue · comments

Looking at the regionRole file, it's missing a check for the title attribute:
https://github.dev/A11yance/aria-query/blob/b656f28b9ec55bbf263db86cb1afa3b1d1efcf5d/src/etc/roles/literal/regionRole.js

All it looks for is aria-label and aria-labelledby. title is also a valid accessible name.

Proof:
image

I thought this issue was originally from @testing-library/dom (testing-library/dom-testing-library#1146), but after reading through the source, this is the library that needs changed.

Not 100% sure, but we may also need to add this to formRole as well:
https://github.dev/A11yance/aria-query/blob/b656f28b9ec55bbf263db86cb1afa3b1d1efcf5d/src/etc/roles/literal/formRole.js

Not 100% sure, but we may also need to add this to formRole as well:

That's very likely. It probably affects all elements that require an accessible name to have an implicit role.

@Sawtaytoes & @eps1lon

So, this is an interesting one. The ARIA spec cites the title attribute as a source for label content in the label calculation model: https://www.w3.org/TR/wai-aria-1.2/#namecalculation. But it is specifically called a "host language mechanism". title is an HTML concept, not an ARIA concept: https://www.w3schools.com/tags/att_global_title.asp

On the other hand, we do list "related" concepts in aria-query and identify the host language as well. The alt attribute on the img role is an analogous example here: https://github.dev/A11yance/aria-query/blob/b656f28b9ec55bbf263db86cb1afa3b1d1efcf5d/src/etc/roles/literal/imgRole.js#L14

But we must consider the reality of the title attribute, whose usage is currently discouraged by the WhatWG and accessibility experts:

  1. https://html.spec.whatwg.org/multipage/dom.html#the-title-attribute
  2. https://www.tpgi.com/using-the-html-title-attribute/

So rather than add it to this project and thereby lend the title attribute some air of utility, I'd rather keep references to it out of, so that folks aren't encouraged to use it.

Soft closing this for now, unless folks want to debate this more. Re-open the issue in that case.

I understand. It sucks, but that's the reality of it 👍.