w3c / html-aria

ARIA in HTML
https://w3c.github.io/html-aria/
Other
178 stars 48 forks source link

Inconsistent allowed roles for "button" elements #395

Closed scottaohara closed 1 year ago

scottaohara commented 2 years ago

This issue was filed while creating the PR to address #375.

input type=image is a graphical version of input type=submit.

The latter, along with input type=reset does not allow for any role.

The former, along with the button element and input type=button allow for specific roles.

A button element defaults to type=submit if the type attribute is missing. The spec does not distinguish the different button types though.

Right now the spec is inconsistent with when these rules apply, so I propose the following:

Make input type=submit, input type=reset, input type=button, input type=image, and button all have the same allowances if not a descendant of a <form> or associated with a <form>. Otherwise, surface a warning that authors SHOULD use type=button or ensure that the implicit submit/reset functionality of the control has been suppressed.

cc @stevefaulkner, @patrickhlauke

patrickhlauke commented 2 years ago

Make input type=submit, input type=reset, input type=button, input type=image, and button all have the same allowances if not a descendant of a <form> or associated with a <form>. Otherwise, surface a warning that authors SHOULD use type=button or ensure that the implicit submit/reset functionality of the control has been suppressed.

the second part of that warning won't make much sense for <input type="image"> though as changing it totype="button"` makes it not be an image input anymore?

scottaohara commented 2 years ago

yeh. someone would have to do <button type=button><img ...></button>