How to add aria-label in Menu.Button #495
-
Hi, anyone here knows how to add |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hey! Thank you for your suggestion! You should be able to just add Another and preferred solution is to do something like this: <Menu.Button>
<svg />
<span class="sr-only">User actions</span>
</Menu.Button> Where you add an element that is marked with the |
Beta Was this translation helpful? Give feedback.
Hey! Thank you for your suggestion!
Much appreciated! 🙏
You should be able to just add
aria-label
to theMenu.Button
, but keep in mind that addingaria-label
means that the contents becomes unreadable. So if you at one point at actual text next to your icon, then that won't be "visible" to screenreader users.Another and preferred solution is to do something like this:
Where you add an element that is marked with the
sr-only
class. This makes it invisible visually, but keeps it for screen readers. Checkout: https://tailwindcss.com/docs/screen-readers for more information,