W3C home > Mailing lists > Public > www-validator-cvs@w3.org > August 2013

[Bug 22846] Wrong error messages when role attribute is used in <input>

From: <bugzilla@jessica.w3.org>
Date: Sun, 04 Aug 2013 13:28:39 +0000
To: www-validator-cvs@w3.org
Message-ID: <bug-22846-169-La3hl432U6@http.www.w3.org/Bugs/Public/>

--- Comment #3 from Jukka K. Korpela <jukka.k.korpela@kolumbus.fi> ---
(In reply to comment #1)

> From the W3C HTML spec,
> it's still unclear to me whether elements with strong native semantics are
> allowed to have role attributes that match their "implicit WAI-ARIA
> semantics".

I don’t see anything unclear here: the W3C HTML5 Candidate Recommendation
specifies that the role attribute is allowed for all elements. Later it imposes
restrictions on its values. 

> The WHATWG spec still explicitly disallows that -

It does. This raises the question what exactly the validator is validating
against: W3C HTML5 CR, W3C HTML 5.1 WD, WHATWG Living HTML du jour, or
something else?

> ...and while the W3C HTML spec doesn't explicitly disallow it, it seems to
> me it's still not clear what it does allow ^

Especially since W3C HTML5 CR explicitly says that the role attribute is
allowed on all elements, it clearly allows anything in that attribute that it
does not explicitly disallow. We can also infer that in all cases, there must
be at least one valid value for the attribute.

> For example, is <input role=dialog> meant to valid? Or <input role=link>?
> etc.

As per W3C HTML5 CR, no, since these attributes would conflict with the strong
native semantics, violating a requirement in the first sentence of 3.2.7. For
<input type=text> (without a suggestions source element), the only allowed
value for role is the default value of textbox. It might be argued that it is
then pointless to specify that attribute, and it might also be argued that it
is pointless to disallow it. In any case, you just need to decide which of the
alternatives you regard as the “HTML5 specification”.

> > <!doctype html><title>Demo</title>
> > <input role=textbox>
> Question: Why are you marking up that way?

I’m not. I encountered it in a discussion about a person’s attempt at learning
to use the role attribute. The error messages caused quite some confusion.

> As far as I understand it, that's
> not useful for accessibility purposes, because UAs already expose <input>
> without a type attribute to AT as a textbox.

Maybe. But it is at least imaginable that some software recognizes the ARIA
role attribute without knowing the intrinsic semantics assigned to some element
in this or that HTML specification.

> > Adding the attribute type=text causes a different error message “Attribute
> > role not allowed on element input at this point”, even though the role
> > attribute is global (allowed on all elements) in HTML5.
> But in some cases the spec additionally gives specific constraints on where
> role can be used, based on its value:
> http://www.w3.org/html/wg/drafts/html/master/dom.html#sec-implicit-aria-
> semantics

First, that part of HTML 5.1 Nightly (which says that “it is inappropriate to
cite this document as other than work in progress”) does not impose any
restrictions on role in <input type=text>. Second, the error message says that
the role attribute is not allowed, instead of complaining about the value of
the attribute.

> Yeah, it does not explicitly disallow <input type=text role=textbox> but
> then it (the W3C version at least) doesn't clearly and explicitly disallow
> <input type=text role=dialog> or <input type=text role=dialog> either, as
> far as I can see.

There is no ambiguity on either issue in the W3C HTML5 CR, and the issues are
distinct: even if the latter were ambiguous, this would not constitute a reason
for regarding the former as ambiguous – it needs to be considered on its own.

>   https://www.w3.org/Bugs/Public/show_bug.cgi?id=15910#c7
> [[
> So I think what we are leaning toward is only allowing cases like <button
> role=button..> if there is also some other aria-* attribute(s) on the
> element; e.g., aria-pressed. 
> ]]

This would make things even more complicated, and I don’t see why you would
allow the role attribute in such a case if you don’t allow it otherwise.

>From what I read between lines, it seems that the odd error message “Element
input is missing one or more of the following attributes: type” for <input
role=textbox> reflects the idea that role=textbox is allowed on <input> but not
for type=text, so the error message is trying to say that the element should
have a type attribute with a value other than text. And the error message
“Attribute role not allowed on element input at this point” is meant to say
that the role attribute with the specific value used in the markup is not
allowed when the type attribute has the value text. But the messages are very
confusing, and for some reason, different error messages are given about
essentially the same situation (type property has the value text, the
difference being just in it having that value by default vs. due to explicit
type=text attribute).

You are receiving this mail because:
You are the QA Contact for the bug.
Received on Sunday, 4 August 2013 13:28:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 23:03:19 UTC