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

Allow title attribute or aria-label attribute instead of accessible child in the "anchor-has-content" rule #727

Merged

Conversation

gorohash
Copy link
Contributor

@gorohash gorohash commented Jul 8, 2020

Fixes #423

Allowed title and aria-label attributes instead of text content in the "anchor-has-content" rule.

@jessebeach
Copy link
Collaborator

@gorohash are you thinking that using both title and aria-label provides visual and non-visual label access?

@gorohash
Copy link
Contributor Author

@jessebeach
I think it provides non-visual label access, but it doesn't necessarily provide enough visual label access.
However, as discussed in #423, icons can provide the meaning visually.

@backwardok
Copy link
Collaborator

backwardok commented Mar 23, 2021

@gorohash Requiring both title and aria-label seems like you're trying to use the title as a hover tooltip for visual affordance, but I don't think that's always necessary. I would update this to allow for passing for having a title or aria-label but not forcing them both to be present.

@gorohash
Copy link
Contributor Author

@backwardok I agree with you. A tooltip shown by title is not always the best way to provide visual affordance. I look forward to your update!

@backwardok
Copy link
Collaborator

Hi @gorohash ! I may have been confusing with my language. I meant I recommend that it be updated to be an OR instead of an AND 🙂 Would you want to make that update to your own code?

@gorohash gorohash force-pushed the anchor-has-title-and-aria-label branch from d423ff5 to ff93739 Compare May 3, 2021 06:20
@gorohash gorohash changed the title Allow title and aria-label attributes in the "anchor-has-content" rule Allow title attribute or aria-label attribute instead of accessible child in the "anchor-has-content" rule May 3, 2021
@gorohash
Copy link
Contributor Author

gorohash commented May 3, 2021

@backwardok Thanks for your advice! I updated my code

@gorohash gorohash force-pushed the anchor-has-title-and-aria-label branch from 5177497 to 2a36fa5 Compare May 3, 2021 06:53
Copy link
Collaborator

@backwardok backwardok left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding in this support!

@ljharb ljharb requested a review from jessebeach May 3, 2021 17:53
@ljharb ljharb force-pushed the anchor-has-title-and-aria-label branch from 2a36fa5 to 1abfa34 Compare July 13, 2021 23:22
@codecov
Copy link

codecov bot commented Jul 13, 2021

Codecov Report

Merging #727 (e6bfd5c) into main (7b3492b) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #727   +/-   ##
=======================================
  Coverage   99.29%   99.29%           
=======================================
  Files         104      104           
  Lines        1555     1557    +2     
  Branches      523      524    +1     
=======================================
+ Hits         1544     1546    +2     
  Misses         11       11           
Files Changed Coverage Δ
src/rules/anchor-has-content.js 100.00% <100.00%> (ø)

@backwardok
Copy link
Collaborator

Hey @jessebeach ! Was wondering if you could review this PR? Thanks! 😄

@ljharb ljharb force-pushed the anchor-has-title-and-aria-label branch from 1abfa34 to e6bfd5c Compare August 12, 2023 00:34
@ljharb
Copy link
Member

ljharb commented Aug 12, 2023

@jessebeach this is freshly rebased; mind giving it a review?

@jessebeach
Copy link
Collaborator

I'll have a look tonight after the kiddo goes to sleep.

Copy link
Collaborator

@jessebeach jessebeach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good improvement.

In the future, we will want to incorporate the mayHaveAccessibleLabel utility and somehow port a consideration for title back into that utility, so that we don't have so much logic directly in a rule, where it might diverge from other similar rules.

But for now, this is an improvement to this rule.

@jessebeach jessebeach merged commit 9688ad8 into jsx-eslint:main Aug 13, 2023
85 checks passed
@jessebeach
Copy link
Collaborator

Thank you @backwardok !!

@jessebeach
Copy link
Collaborator

ack, apologies @ljharb! I hit the Merge button on this one. I know you like to merge the commits in a different way.

@ljharb
Copy link
Member

ljharb commented Aug 13, 2023

No worries, it’s fine :-) thanks for reviewing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

anchor-has-content and aria-label / title tags?
4 participants