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

[checkbox] Show Checkmark to users with reduced-motion enabled #3537

Merged
merged 4 commits into from
Jul 20, 2023

Conversation

kendallgassner
Copy link
Contributor

When testing Stylelint-a11y rules I noticed that our Checkbox component does not show the checkmark when reduced motion is turned on:

A screenshot of the Checkbox Component on Storybook. The checkbox is selected and filled in with a blue background; however the checkmark is not visible.

Closes # (type the issue number after # if applicable; otherwise remove this line)

Screenshots

Please provide before/after screenshots for any visual changes

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Changes are SSR compatible
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@kendallgassner kendallgassner requested a review from TylerJDev July 18, 2023 19:33
@changeset-bot
Copy link

changeset-bot bot commented Jul 18, 2023

🦋 Changeset detected

Latest commit: a7ada69

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@primer/react Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@kendallgassner kendallgassner marked this pull request as ready for review July 18, 2023 19:33
@kendallgassner kendallgassner requested review from a team and langermank July 18, 2023 19:33
@github-actions
Copy link
Contributor

github-actions bot commented Jul 18, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 102.71 KB (-0.03% 🔽)
dist/browser.umd.js 103.25 KB (-0.03% 🔽)

@kendallgassner kendallgassner temporarily deployed to github-pages July 18, 2023 19:39 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3537 July 18, 2023 19:40 Inactive
@kendallgassner
Copy link
Contributor Author

Updating tests now...

@kendallgassner kendallgassner temporarily deployed to github-pages July 18, 2023 19:53 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3537 July 18, 2023 19:54 Inactive
Copy link
Contributor

@TylerJDev TylerJDev left a comment

Choose a reason for hiding this comment

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

Very nice! ✨

@kendallgassner kendallgassner enabled auto-merge July 18, 2023 20:50
Copy link
Member

@joshblack joshblack left a comment

Choose a reason for hiding this comment

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

Just wanted to double-check, this seems to include the animation if prefers-reduced-motion is true. Would another possible path here be to add the following declaration to the checked -> before selector:

  &:checked,
  &:indeterminate {
    background: ${get('colors.accent.fg')};
    border-color: ${get('colors.accent.fg')};

    &::before {
+     clip-path: inset(0 0 0 0);

      @media screen and (prefers-reduced-motion: no-preference) {
        animation: checkmarkIn 80ms cubic-bezier(0.65, 0, 0.35, 1) forwards 80ms;
      }
    }
  }

So that it still appears with prefers-reduced-motion set but without the animation 👀

@kendallgassner
Copy link
Contributor Author

@joshblack The animation is very minimal, I think it would be okay to leave in the motion for reduced-motion users.

@ericwbailey or @ichelsea could you also weigh in?

@ericwbailey
Copy link
Contributor

My take is that the animation is minimal and user-initiated. I'd feel comfortable removing the query.

@ichelsea
Copy link

@kendallgassner I agree with Eric!

@kendallgassner kendallgassner added this pull request to the merge queue Jul 20, 2023
Merged via the queue into main with commit 311c8c9 Jul 20, 2023
@kendallgassner kendallgassner deleted the fix-checkbox-in-reduced-motion branch July 20, 2023 14:44
@primer-css primer-css mentioned this pull request Jul 20, 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

Successfully merging this pull request may close these issues.

5 participants