learn.svelte.dev icon indicating copy to clipboard operation
learn.svelte.dev copied to clipboard

Solve the ARIA-ROLE error thrown @Part 2/Actions/The use directive

Open Ayyanaruto opened this issue 1 year ago • 4 comments

Screenshot from 2024-01-01 12-55-02

Added a role attribute to remove the warning in both unsolved and solved one

Ayyanaruto avatar Jan 01 '24 08:01 Ayyanaruto

@Ayyanaruto is attempting to deploy a commit to the Svelte Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] avatar Jan 01 '24 08:01 vercel[bot]

thank you! @geoffrich can I ask you to take a look at this — is presentation the right role, or would button (or something else) be more correct in this case?

Rich-Harris avatar Jan 23 '24 19:01 Rich-Harris

Oh and there's also #567 which additionally adds an aria-label — is that appropriate in this context?

Rich-Harris avatar Jan 23 '24 20:01 Rich-Harris

Hm, I think this is actually a case where it's perfectly valid to ignore the warning. Maybe we want to add the svelte-ignore comment to this example?

In general, you don't want to put click handlers on divs. However, in this case a screen reader can close the modal with the Escape key, so we aren't locking any functionality behind clicking with a mouse.

I'd have to test with a screen reader to be sure, but I don't think role="presentation" will actually do anything tangible other than silence Svelte's warning. A div is already meaningless, semantically.

geoffrich avatar Jan 29 '24 04:01 geoffrich