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

Add support for aria-current=false #1060

Merged
merged 1 commit into from
May 21, 2020
Merged

Conversation

simurai
Copy link
Contributor

@simurai simurai commented Apr 7, 2020

This PR adds support for using aria-current=false.

Problem

In #1006 we added support for using aria-current to add a "selected" state. But on dotcom there were cases where instead of removing the aria-current attribute, it was set to aria-current=false. The CSS selector of [aria-current] was still valid, thus making all items look selected. See https://github.com/github/github/issues/140091.

Fix

By using a [aria-current]:not([aria-current=false]) selector, an item looks selected with any of the options like page, step, true etc., except when using aria-current=false:

aria-current

👀 Preview

Concerns

  • Higher specificity. Although a nice side effect is that we don't need this :hover selector anymore.
  • In the past, using :not() was bad for performance. But I think most browser found a way to optimize that by now.

TODO on dotcom


Fixes #1019

@vercel
Copy link

vercel bot commented Apr 7, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/primer/primer-css/6y8lb0map
✅ Preview: https://primer-css-git-fix-aria-current.primer.now.sh

@simurai simurai marked this pull request as ready for review April 7, 2020 07:51
Copy link
Contributor

@emilybrick emilybrick left a comment

Choose a reason for hiding this comment

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

@simurai simurai changed the base branch from master to release-14.4.0 May 21, 2020 06:59
@simurai simurai merged commit 9798f56 into release-14.4.0 May 21, 2020
@simurai simurai deleted the fix-aria-current branch May 21, 2020 07:00
@simurai simurai mentioned this pull request May 21, 2020
5 tasks
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.

Fix aria-current=false
2 participants