You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<label for="phone-number">
Enter your phone number
<input type="text" id="phone-number" aria-describedby="phone-error" />
</label>
<div id="phone-error" role="alert">
Sorry, that area code is not valid
</div>
Most screen reader + browser combinations return nothing as the accessible description for #phone-number. However, many developers (reasonably) expect the description to be the contents of the #phone-error. I'm seeing this pattern more frequently in the wild.
This is because aria-describedby references an element with role="alert". The ARIA 1.1 spec states that the name of role="alert" is from the author. The accname spec states that name from author is derived from aria-label or aria-labelledby attributes, while "name from content" is derived from the content of the element.
detailed support information of this pattern for different browser and screen reader combinations (only JAWS passes)
related firefox issue which states that this is the expected behavior due to the rationale cited above
However, Step 2F of accname-1.1 states "Otherwise, if the current node's role allows name from content, or if the current node is referenced by aria-labelledby, aria-describedby, or is a native host language text alternative element (e.g. label in HTML), or is a descendant of a native host language text alternative element... [compute as name from content]"
The key is "Or if the current node is referenced by aria-labelledby, aria-describedby..."
Therefore I read that to mean that the content should be returned as the description because it is referenced by aria-describedby. Yes, role="alert" will get its accessible name from the author, but when it doesn't have a name from the author and is referenced via aria-describedby, its contents must be returned.
Is my understanding correct? Since most screen reader and browser combinations seem to disagree with my interpretation, I'd like to get this clarified so that the issue can be addressed appropriately.
The text was updated successfully, but these errors were encountered:
Given this code example
Most screen reader + browser combinations return nothing as the accessible description for
#phone-number
. However, many developers (reasonably) expect the description to be the contents of the#phone-error
. I'm seeing this pattern more frequently in the wild.This is because
aria-describedby
references an element withrole="alert"
. The ARIA 1.1 spec states that the name ofrole="alert"
is from the author. The accname spec states that name from author is derived fromaria-label
oraria-labelledby
attributes, while "name from content" is derived from the content of the element.However, Step 2F of accname-1.1 states "Otherwise, if the current node's role allows name from content, or if the current node is referenced by aria-labelledby, aria-describedby, or is a native host language text alternative element (e.g. label in HTML), or is a descendant of a native host language text alternative element... [compute as name from content]"
The key is "Or if the current node is referenced by aria-labelledby, aria-describedby..."
Therefore I read that to mean that the content should be returned as the description because it is referenced by
aria-describedby
. Yes, role="alert" will get its accessible name from the author, but when it doesn't have a name from the author and is referenced via aria-describedby, its contents must be returned.Is my understanding correct? Since most screen reader and browser combinations seem to disagree with my interpretation, I'd like to get this clarified so that the issue can be addressed appropriately.
The text was updated successfully, but these errors were encountered: