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

Fix and rename LandmarkHasLabel rule to NavigationHasLabel #64

Merged
merged 3 commits into from
Apr 11, 2023

Conversation

khiga8
Copy link
Collaborator

@khiga8 khiga8 commented Apr 6, 2023

Fixes: https://github.com/github/accessibility/issues/3290

This is a lint rule that was written before our teams time that looks like we need to revisit.

This appears to be flagging all <aside>, <nav> , and <section> without an accessible name.

Flagging <section> seems incorrect since we don’t know if the <section> is intended to be a landmark. A <section> only becomes a region landmark if its labelled, but we don't know if the developer intends it to be.

Similarly, I am not sure we about flagging <aside>.

I think it makes sense to enforce a navigation landmark to have an accessible name given that GitHub sites usually have multiple navigation and it would help for those to be labelled.

I am simplifying this rule significantly from what it is currently doing so it only flag:

  • flags if nav or role="navigation" has no label.
  • additionally suggests using a nav if role="navigation" is being used.

Consequently, I renamed the rule to be NavigationHasLabel. If we decide we want to add more enforcements around landmark, it should be a more scoped rule.

@khiga8 khiga8 changed the title Fix LandmarkHasLabel lint rule logic Fix and rename LandmarkHasLabel rule Apr 6, 2023
@khiga8 khiga8 marked this pull request as ready for review April 6, 2023 23:30
@khiga8 khiga8 requested a review from a team as a code owner April 6, 2023 23:30
@khiga8 khiga8 changed the title Fix and rename LandmarkHasLabel rule Fix and rename LandmarkHasLabel rule to NavigationHasLabel Apr 6, 2023
@accessibility-bot
Copy link

👋 Hello and thanks for pinging us! An accessibility first responder will review this soon.

  • 💻 On PRs for our review: please provide a review environment with steps to validate, screenshots (with alt text), or videos demonstrating functionality we should be checking. This will help speed up our review and feedback cycle.
  • ⚠️ If this is urgent, please visit us in #accessibility on Slack and tag the first responder(s) listed in the channel topic.

include ERBLint::Linters::CustomHelpers
include LinterRegistry

MESSAGE = "The navigation landmark should have a unique accessible name via `aria-label` or `aria-labelledby`."
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we say/ check that users do not include "navigaiton" in the name

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I added it to the message. As for it being a check, I'm open to following up on it separately, maybe as a distinct rule.

@khiga8 khiga8 merged commit 94d782c into main Apr 11, 2023
@khiga8 khiga8 deleted the kh-fix-landmark-logic branch April 11, 2023 16:53
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

Successfully merging this pull request may close these issues.

None yet

3 participants