Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using the form’s role attribute #85

Closed
yatil opened this issue Aug 20, 2015 · 6 comments
Closed

Using the form’s role attribute #85

yatil opened this issue Aug 20, 2015 · 6 comments

Comments

@yatil
Copy link

yatil commented Aug 20, 2015

There has been a twitter conversation that started by an Validator warning:

<form role="search">

Warning: Element form does not need a role attribute

Now I know that it violates the second rule of ARIA use:

Do not change native semantics, unless you really have to.

Yet the specifications do not facilitate that and there seems to be no indication that this behavior is wrong, for example:

Now, a validator warning is not an error, and developers can chose to ignore it. On the other hand having <form role="search"> seems to feel natural for many people (including me when I first heard about the search role a few years back).

What one could do:

  • Make search a subclass of form (if even possible) and get rid of the validator warning. (That may have implications in the current implementations of AT.
  • Outlaw any roles on form (but presentation, I suppose) for HTML5.1 and have the validator display an error.
  • (… other ideas welcome …)

At least the WCAG technique should be changed to reflect best practices (see w3c/wcag#113)). There is no indication (but it hasn’t been sufficiently tested) that <form role="search"> breaks AT support, but it feels like this is a glitch in the ARIA matrix that should be clarified.

Related: See @aardrian’s blog post on this issue: Where to Put Your Search Role

(Thanks to the input @rogerjohansson, @aardrian, @LJWatson, @stevefaulkner, @cptvitamin and others.)

yatil added a commit to w3c/wai-quick-start that referenced this issue Sep 11, 2015
See w3c/aria#85 (It’s complicated)

Also, the search input missed an id attribute.
@Volker-E
Copy link

Volker-E commented Oct 1, 2015

"On the other hand having <form role="search"> seems to feel natural for many people (including me when I first heard about the search role a few years back)" --

@yatil I wonder why you're after laying it out like above were choosing to change to adding an extra DOM element <div role="search"> instead of making search a subclass of form. There's people out there publishing it "as specialized version of form".

Adding roles is already hard to get around for some developers (personally fighting for due to missing mapping to semantic elements by older browsers), but adding extra --otherwise superfluous-- DOM element seems illogical at best to many.

@yatil
Copy link
Author

yatil commented Oct 2, 2015

Hi @Volker-E – Well, that is exactly what we want to find out here. At the moment specs seem to have no clear indication if role="search" can be used on a form or not. Currently I, personal, would like to avoid the questions by using <form><div role="search"> as it provides the best of both worlds and doesn’t throw an error in the validator. I agree that it is an additional superfluous element and probably is illogical, but we won’t know until this issue is resolved.

@yatil
Copy link
Author

yatil commented Dec 16, 2015

Looks like this is resolved by @stevefaulkner here: w3c/html-aria#18.

@ZoeBijl
Copy link

ZoeBijl commented Jan 12, 2016

Can this be closed?

@yatil
Copy link
Author

yatil commented Jan 12, 2016

I think so, feel free to close it.

@ZoeBijl
Copy link

ZoeBijl commented Jan 12, 2016

Well if it's fixed… Let's close it up :)

@ZoeBijl ZoeBijl closed this as completed Jan 12, 2016
pkra pushed a commit that referenced this issue May 20, 2024
closes #85

Removing allowance for `role=button` on `summary`.
pkra pushed a commit that referenced this issue May 20, 2024
section maps to region only if acc name, otherwise to div
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants