This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 15910 - Broken check for type attribute on button element
Summary: Broken check for type attribute on button element
Status: RESOLVED FIXED
Alias: None
Product: HTML Checker
Classification: Unclassified
Component: General (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: ---
Assignee: Michael[tm] Smith
QA Contact: qa-dev tracking
URL:
Whiteboard:
Keywords:
Depends on: 11557
Blocks:
  Show dependency treegraph
 
Reported: 2012-02-06 12:17 UTC by William Hatever
Modified: 2015-08-23 07:07 UTC (History)
1 user (show)

See Also:


Attachments

Description William Hatever 2012-02-06 12:17:35 UTC
The following HTML5 fragment fails to validate with a "Bad value submit for attribute type on element button" error message, whereas said value is perfectly valid according to HTML5 specs:

<form id="action1" action="/"></form>
<button form="action1" type="submit">Submit</button>
Comment 1 William Hatever 2012-02-06 12:19:18 UTC
Link to current spec: http://dev.w3.org/html5/spec-author-view/the-button-element.html#attr-button-type-submit
Comment 2 William Hatever 2012-02-06 12:20:39 UTC
Also when omitting the type attribute (which should default to type="submit" anyway, according to the aforementioned document) the validator complains a required attribute is missing.
Comment 3 Michael[tm] Smith 2012-02-06 13:57:48 UTC
I can't reproduce this with the markup fragment you provided.
Comment 4 Michael[tm] Smith 2012-02-08 12:53:53 UTC
Julien,

If you can please re-check your doc at http://validator.w3.org/nu/ I'd appreciate it.

Over the last 10 days or so I had been making some changes to the the validator HTML5 backend, and that might have left things in an unstable state that caused the problem you reported. But I now have things synced up and stable, so I think you should not see this problem again. But please let me know if you can still reproduce it.
Comment 5 William Hatever 2012-02-08 13:01:51 UTC
So it appears that by over-simplifying the fragment I removed the bug :)

This works fine:

<form id="action1" action="/"></form>
<button form="action1" type="submit">Submit</button>

But this triggers the error, even on http://validator.w3.org/nu/ tonight:

<form id="action1" action="/"></form>
<button form="action1" type="submit" role="button">Submit</button>

Sorry for the bad report earlier :-(
Comment 6 William Hatever 2012-02-08 13:04:14 UTC
It seems to be cause by the "role" attribute, specifically. Other attributes )e.g. data-whatever) don't trigger any error.
Comment 7 Michael[tm] Smith 2012-02-09 03:11:25 UTC
(In reply to comment #5)
> So it appears that by over-simplifying the fragment I removed the bug :)
> 
> This works fine:
> 
> <form id="action1" action="/"></form>
> <button form="action1" type="submit">Submit</button>
> 
> But this triggers the error, even on http://validator.w3.org/nu/ tonight:
> 
> <form id="action1" action="/"></form>
> <button form="action1" type="submit" role="button">Submit</button>
> 
> Sorry for the bad report earlier :-(

No problem at all.

Answer: Consider just removing the role attribute. I'm not sure why you've added it there, but if it's for the purpose of making your app accessible to users of AT software, I don't think it's necessary, because I think the AT already knows that the button element is a button, and the AT can let the user know that without you needing to put a role attribute on it.

That is, at least for the simple case. But if you also have some other aria-* attributes on that element, then please let me know. Because I think that's a bit of a different case. Or if there's some other reason you're adding it (customer requirement or guidelines published somewhere or something), lemme know.

So the background on this is that I know what's causing this problem and how to fix it but I'm not ready to make that fix yet. The role-checking behaving is in the part of the validator backend that does ARIA checking, and that part is currently incomplete. I have a patch I've been working on to make it more complete, but that patch is not finished yet:

https://bitbucket.org/validator/syntax-patches/src/default/aria

Also, the HTML5 spec currently does not clearly allow <button role=button...>. See the following bug:

"Authors should not be allowed to specify roles on elements that they already have by default"
https://www.w3.org/Bugs/Public/show_bug.cgi?id=11557

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. 

So anyway, we are going to need an HTML5 spec change before I can do anything to make a validator change for this.
Comment 8 Michael[tm] Smith 2013-04-20 13:59:38 UTC
Fixed in the validator sources now. I'll push the change to the W3C validator later today.