Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ShareButton's aria-label is interfering with what I really want to say. #397

Closed
yamanoku opened this issue May 16, 2021 · 1 comment
Closed

Comments

@yamanoku
Copy link

yamanoku commented May 16, 2021

Nice to meet you! I just found out about this library today 👍🏼

The share button in this library has an aria-label, but I feel that this response doesn't explain enough about what the button is supposed to do.


For example, the Twitter share button is converted to the following in demo page.

<button aria-label="twitter" class="react-share__ShareButton Demo__some-network__share-button">
  <svg viewBox="0 0 64 64" width="32" height="32">
    <circle cx="32" cy="32 " r="31" fill="#00aced"></circle>
    <path d="M48,22.1c-1.2,0.5-2.4,0.9-3.8,1c1.4-0.8,2.4-2.1,2.9-3.6c-1.3,0.8-2.7,1.3-4.2,1.6 c41.7,19.8, 40,19,38.2,19c-3.6,0-6.6,2.9-6.6,6.6c0,0.5,0.1,1,0.2,1.5c-5.5-0.3-10.3-2.9-13.5-6.9c-0.6,1-0.9,2.1-0.9,3.3 c0,2.3,1.2,4.3,2.9,5.5c- 1.1,0-2.1-0.3-3-0.8c0,0,0,0.1,0,0.1c0,3.2,2.3,5.8,5.3,6.4c-0.6,0.1-1.1,0.2-1.7,0.2c-0.4,0-0.8,0-1.2-0.1 c0.8,2.6,3.3,4.5,6.1,4.6c-2 .2,1.8-5.1,2.8-8.2,2.8c-0.5,0-1.1,0-1.6-0.1c2.9,1.9,6.4,2.9,10.1,2.9c12.1,0,18.7-10,18.7-18.7 c0-0.3,0-0.6,0-0.8c46,24.5,47.1,23.4, 48,22.1z" fill="white"></path>
  </svg>
</button>

This seems to be the minimum way to ensure accessibility.

But what if you use it in the following way?

<TwitterShareButton title="Please share url !" url="https://example.com" class="Demo__some-network__share-button">
  Please share url !
</TwitterShareButton>.

This would translate to the following.

<button aria-label="twitter" class="Demo__some-network__share-button">
  Please share url !
</button>

What I'm trying to tell you is that the button description exists separately in the button's aria-label and in the internal text.

To make matters worse, the button only reads "twitter" when read out loud by assistive technologies (For example, a screen reader).


My suggestions for improvement on this issue are as follows

Remove aria-label from ShareButton.tsx.

Specifically, remove this part.

aria-label={rest['aria-label'] || networkName}

This would be a destructive change in code, but I think it would be worse if accessibility checks such as Lighthouse and axe had something in aria-label that on the surface looks fine and goes unnoticed.

I think we should let the developers who use the library think about the button description.

Add notes on aria-label to README.

If it is difficult to make changes to the code, I think it would be a good idea to add a note in the README that aria-label is already set.
If the existing service name aria-label is not enough to explain, you may need to override it with aria-label.

@nygardk
Copy link
Owner

nygardk commented Nov 18, 2023

Fixed in v5

@nygardk nygardk closed this as completed Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants