w3c / html-aria

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

Button with type="button" doesn't support role="combobox" #516

Closed admrwe closed 2 months ago

admrwe commented 2 months ago

In a 2022 PR (https://github.com/w3c/html-aria/pull/396) it appears the the button element was updated to accept a role="combobox", and the same change was made to the w3c Validator (https://github.com/validator/validator/pull/1301). However, I am still seeing parsing errors throw when role="combobox" is added to a button using type="button".

For example, this is invalid:

<button type="button" role="combobox" aria-expanded="false">Foo</button>

But this is valid:

<button role="combobox" aria-expanded="false">Foo</button>

Was this an oversight in the previous change? I don't believe it makes sense for role="combobox" to only be valid on a button using the implicit type="submit", since I would think that in a combobox pattern you would explicitly not want a button to submit its parent form, since the job of a button role="combobox" is to control its associated popup element.

Am I overlooking something? Or is this an additional improvement that could be made to the aria spec and the validator to support valid use cases of a combobox button?

scottaohara commented 2 months ago

Seems an issue with the validator if it’s making a distinction between the different button types. This spec doesn’t distinguish between the types for the button element, so it is allowed on any type.

admrwe commented 2 months ago

Good to know! I will move this issue over to the validator repository - much appreciated!