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

-----Original Message-----
From: WebAIM-Forum < <EMAIL REMOVED> > On Behalf Of konstantin galiakhmetov
Sent: Wednesday 24 August 2022 09:45
To: <EMAIL REMOVED>
Subject: [EXTERNAL] [WebAIM] 4.1.2 correct roles

[You don't often get email from <EMAIL REMOVED> . Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]

hello all:
how do you thinkk The Following Code Snippet is a failure of SC 4.1.2 or not?
<h1 onclick="alert('hello')">Test</h1>
SC4.1.2 requreis that For all user interface components role can be programmatically determined and in this code snipped the role can be programmatically determined. I mean <h1> has implicit role "heading" so here no any errors. Or not?
what do you think about it?