E-mail List Archives
Thread: Does providing null ("") for Role, Name, id break Accessibility in any way ?
Number of posts in this thread: 4 (In chronological order)
From: allyssa jessicon
Date: Sat, Jul 29 2023 1:40PM
Subject: Does providing null ("") for Role, Name, id break Accessibility in any way ?
No previous message | Next message →
Hello list,
We have a piece of code where id="" , role="" and name="" (all null)
used in many scenarios for various reasons, running automated scripts
for the page containing the code resulting in failure with the message
"Element does not have inner text that is visible to screen readers".
Is this a cause of concern for Accessibility? The controls work just
fine with all major screen readers though.
Appreciate your response.
Thanks.
From: jp Jamous
Date: Sat, Jul 29 2023 1:44PM
Subject: Re: Does providing null ("") for Role, Name, id break Accessibility in any way ?
← Previous message | Next message →
While everything is working good, I would fail this if I was testing a page. Also, automated tools would fail it.
The ID may not be the biggest concern, but the Role would be. It would fail Role, Name Value.
I prefer to have values for all of those by default, then the script can change them when the JS execute. Nothing wrong with this approach. However, leaving them empty is bad markup and would fail 1.4.2.
From: Birkir R. Gunnarsson
Date: Sat, Jul 29 2023 2:31PM
Subject: Re: Does providing null ("") for Role, Name, id break Accessibility in any way ?
← Previous message | Next message →
ARIA does not allow for an empty role attribute value, that's invalid markup.
At best, and fortunately this appears to be the case, it's ignored by
browsers/screen readers.
At worst this would remove the native role attribute from the elements
where they are present, e.g. buttons/links/headings etc.
This is invalid markup, and I have a hard time seeing why you'd want
it on the page (a role attribute without a pre-determined value that
is).
Again, if you can verify through testing with a sufficient
combinations of screen readers and browsers that this does not impact
the user experience you can justify keeping it, but I'd definitely see
if there could be ways to do it differently.
On 7/29/23, jp Jamous < = EMAIL ADDRESS REMOVED = > wrote:
> While everything is working good, I would fail this if I was testing a page.
> Also, automated tools would fail it.
>
> The ID may not be the biggest concern, but the Role would be. It would fail
> Role, Name Value.
>
> I prefer to have values for all of those by default, then the script can
> change them when the JS execute. Nothing wrong with this approach. However,
> leaving them empty is bad markup and would fail 1.4.2.
>
>
From: tim.harshbarger
Date: Mon, Jul 31 2023 8:09AM
Subject: Re: Does providing null ("") for Role, Name, id break Accessibility in any way ?
← Previous message | No next message
You may want to patch your framework so that it only adds the id, role, and name attributes when they are not null.
The thing with invalid markup like this is that it might work OK today. It might always work OK. However, since it is invalid markup, there is no guarantee that it will continue to work. And by the time you notice it is no longer working, the issue will be everywhere and cause a lot of people major headaches.
If it is a possibility, you might want to add a fix for this on the road map of whatever framework you might be using or whatever code is generating this.