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

Update hover styles for ActionList item #3815

Merged
merged 4 commits into from
Oct 16, 2023
Merged

Update hover styles for ActionList item #3815

merged 4 commits into from
Oct 16, 2023

Conversation

pksjce
Copy link
Collaborator

@pksjce pksjce commented Oct 13, 2023

Closes #2479

In dark high contrast theme, the ActionMenu shows no hover color since the hover color and the menu overlay color are the same in this particular theme. However, if we refer to the view_components implementation, we see that they have a hover shadow as well which does the job pretty well in this theme. I've added the same shadow styles to ActionListItem. This looks great as the fix for our bug without regressing during other cases.

Before

Screen.Recording.2023-10-13.at.2.28.38.pm.mov

After

Screen.Recording.2023-10-13.at.2.30.48.pm.mov

Note

This fixes Light High contrast mode ActionItems as well.

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan

Testing & Reviewing

Merge checklist

  • Added/updated tests
  • Added/updated documentation
  • Added/updated previews (Storybook)
  • 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.

@pksjce pksjce requested review from a team and joshblack October 13, 2023 03:34
@changeset-bot
Copy link

changeset-bot bot commented Oct 13, 2023

🦋 Changeset detected

Latest commit: 1bee44a

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

@github-actions
Copy link
Contributor

github-actions bot commented Oct 13, 2023

size-limit report 📦

Path Size
dist/browser.esm.js 104.77 KB (+0.04% 🔺)
dist/browser.umd.js 105.36 KB (+0.04% 🔺)

@github-actions github-actions bot temporarily deployed to storybook-preview-3815 October 13, 2023 03:42 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3815 October 13, 2023 03:43 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3815 October 13, 2023 03:44 Inactive
@pksjce pksjce temporarily deployed to github-pages October 13, 2023 03:46 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3815 October 13, 2023 03:46 Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3815 October 13, 2023 04:03 Inactive
@pksjce pksjce temporarily deployed to github-pages October 13, 2023 04:05 — with GitHub Actions Inactive
@github-actions github-actions bot temporarily deployed to storybook-preview-3815 October 13, 2023 04:05 Inactive
Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

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

Nice! Just one comment about the color token.

@@ -125,6 +125,7 @@ export const Item = React.forwardRef<HTMLLIElement, ActionListItemProps>(
':hover:not([aria-disabled])': {
backgroundColor: `actionListItem.${variant}.hoverBg`,
color: getVariantStyles(variant, disabled).hoverColor,
boxShadow: `inset 0 0 0 max(1px, 0.0625rem) ${theme?.colors.border.muted}`,
Copy link
Contributor

@langermank langermank Oct 13, 2023

Choose a reason for hiding this comment

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

Suggested change
boxShadow: `inset 0 0 0 max(1px, 0.0625rem) ${theme?.colors.border.muted}`,
boxShadow: `inset 0 0 0 max(1px, 0.0625rem) ${theme?. actionListItem.default.activeBorder}`,

I'm not sure if that syntax is right, maybe its:

boxShadow: `inset 0 0 0 max(1px, 0.0625rem) actionListItem.default.activeBorder`,

Regardless, this should use the ActionList specific color token which you can also see in the Primer View Components version 😄

Copy link
Member

Choose a reason for hiding this comment

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

I think with the sx prop it needs to either be just the token or uses that theme from context, potentially? So with the new token it would be:

Suggested change
boxShadow: `inset 0 0 0 max(1px, 0.0625rem) ${theme?.colors.border.muted}`,
boxShadow: `inset 0 0 0 max(1px, 0.0625rem) ${theme?.colors.actionListItem.default.activeBorder}`,

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Me and @broccolinisoup went back and forth with the colors and got confused! Thanks for this input. I have updated the PR!

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.

LGTM after the token change! 🥳

Copy link
Member

@broccolinisoup broccolinisoup left a comment

Choose a reason for hiding this comment

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

Looks really good! 🚀

Note: I am not sure if it is just me but the after video in the PR description, doesn't render for me. In case you would like to update for future references 😊

Copy link
Contributor

@langermank langermank left a comment

Choose a reason for hiding this comment

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

Looks perfect! Thanks for making that change 😄

@pksjce pksjce added this pull request to the merge queue Oct 16, 2023
Merged via the queue into main with commit 794a477 Oct 16, 2023
30 checks passed
@pksjce pksjce deleted the pk/action-menu-hover branch October 16, 2023 14:59
This was referenced Oct 16, 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.

ActionMenu does not have hover styles in Dark high contrast theme
4 participants