WebAIM - Web Accessibility In Mind

E-mail List Archives

Re: 4.1.2 correct roles

for

From: Mark Magennis
Date: Aug 24, 2022 2:59AM


Konstantin,

Functionally this is a button so it should have a button role. It's okay to have an element that is both a heading and a button though:

<h1><button onclick="alert('hello')">Test</button></h1>

Note that the button must be within the heading, not the heading within the button.

Mark