bhadaway / blankslate

A naked WordPress theme, powering over 10k websites. Buy me a sandwich. 🥪
https://opencollective.com/blankslate
328 stars 92 forks source link

role="" is considered unnecessary #36

Closed robertandrews closed 2 years ago

robertandrews commented 2 years ago

W3C Validator issues many Info warnings like: "The 'banner' role is unnecessary for element 'header'"... but also for others beside 'banner'.

https://stackoverflow.com/questions/48814890/are-role-attributes-necessary-in-html5

Seems like enforcing "role", where an expressive semantic element already makes it clear, is considered a kind of tautology, eg. role="navigation" in <nav>

It's an info warning, not an error, but may be an opportunity for you to cut some wordage if you wanted, as long as you left in-place any roles in non-corresponding elements.

Personally, maybe I get off on seeing role="" and being forced to think about it, but I guess W3C is saying I don't need to.

Is there any backward-compatibility reason to leave them in situ?

These are the reported warnings I see for a single post page...

Screenshot 2022-03-19 at 20 42 22
bhadaway commented 2 years ago

I agree and even removed them at one point, but WordPress.org still requires them:

https://make.wordpress.org/themes/handbook/review/accessibility/required/#aria-landmark-roles