E-mail List Archives
Thread: what does a default value for aria-level mean if it's required?
Number of posts in this thread: 4 (In chronological order)
The spec for role="heading" (https://www.w3.org/TR/wai-aria/#heading) says:
*Required States and Properties: *aria-level
*Implicit Value for Role: *Default for aria-level is 2.
Is aria-level really required? The Nu Html Checker (
https://validator.w3.org/nu/) does not complain if I don't have an
If aria-level **is* *required for role="heading", how can you have a
default value? The validator complains if I have an empty value
<div role="heading" aria-level>
I'm not following how an implicit value of 2 is used for aria-level if
aria-level is required and needs a value.
Well, aria-level is a required attribute for role="heading".
But, as so often happens, if authors specify role=Heading" without a
value, the browsers/assistive technologies are left with the choice of
not exposing it at all or exposing it as a heading of some level.
The decision was made that, rather than ignoring it altogether (which
from the semantic point of view is the right thing to do, but not so
much from the assistive technology user point of view), that it should
be exposed as an h2 heading.
There is no browser default for "heading of undetermined level" so a
default level had to be specified, and 2 was the most likely
So this is a case where browsers/AT tries to make up for missing
author specification for the sake of the user.
You see this elsewhere, e.g. when Jaws reads the file name for the
image file (without the path) for image elements with no alt
attributes, though that is the decision of a specific screen reader
manufacturer rather than something recommended by the W3C (Voiceover
on iOS, for instance, ignores static images without alt attribute).
So, in a sense you are right that it is confusing that, when a
required attribute is missing that the element is still exposed to
users with a default value, and this is rather the exception than the
On 1/20/20, glen walker < = EMAIL ADDRESS REMOVED = > wrote:
> The spec for role="heading" (https://www.w3.org/TR/wai-aria/#heading) says:
> *Required States and Properties: *aria-level
> *Implicit Value for Role: *Default for aria-level is 2.
> Is aria-level really required? The Nu Html Checker (
> https://validator.w3.org/nu/) does not complain if I don't have an
> <div role="heading">
> If aria-level **is* *required for role="heading", how can you have a
> default value? The validator complains if I have an empty value
> <div role="heading" aria-level>
> I'm not following how an implicit value of 2 is used for aria-level if
> aria-level is required and needs a value.
> > > > >
Work hard. Have fun. Make history.
I get why AT might have a default value. My question was more about the
spec itself. If an attribute is required and can have a default value,
that sort of implies that I don't have to specify a value but I do have to
have the attribute name. But that doesn't work. aria-level is not a
boolean attribute. It must have a value and the value must be an integer.
There's no way to get a default value. So my question is mainly with
regards to the spec and why it says it has a default value.
Quick followup. Both the ARIA 1.1 and 1.2 specs have the same problem
mentioning a required attribute but also mentioning there's a default
value. However, the latest editor's draft of 1.2,
https://rawgit.com/w3c/aria/master/#heading, does *not* have the default
value information and specifically says "authors MUST use the aria-level
attribute to indicate the proper nesting level". Sounds like it's resolved.