I'm using react and I have a table with a Delete action column. I'm displaying a delete button in each row and want to have alt text for the entire button but I'm not sure how to do this since does not come with an alt option. I tried the below code but it doesn't work. I know I'm not doing it correctly so I wanted some guidance.
Also, I'm using the iconify library for my icon.
const DelButton = () => {
return (
<Link to="/someLink">
<button aria-label="Delete" title="Delete">
<Icon icon="gg:trash-empty" alt="Delete"/>
</button>
</Link>
)
}
Using
aria-labelon thebuttonelement should be sufficient.You should remove the
altattribute from yourIconelement. If it doesn't render to animgelement, then it's not valid HTML anyway.aria-labelnot only takes precedence over thetitleattribute in the accessible name computation, but it also enjoys quite a bit better browser support.