Skip to content

Commit

Permalink
Prevents text color from changing on hover for "inactive" ActionMenu.…
Browse files Browse the repository at this point in the history
…Items of the "danger" variant (#4651)

* prevents inactive danger actionmenu items from changing color on hover

* adds changeset
  • Loading branch information
mperrotti committed Jun 17, 2024
1 parent 623b16e commit b13bbb3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/honest-olives-laugh.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Prevents text color from changing on hover for "inactive" ActionMenu.Items of the "danger" variant. Before this change, the text color would change on hover. After this change, the text color remains the same on hover.
7 changes: 4 additions & 3 deletions packages/react/src/ActionList/Visuals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@ export const LeadingVisual: React.FC<React.PropsWithChildren<VisualProps>> = ({s
{
color: getVariantStyles(variant, disabled, inactive).iconColor,
svg: {fontSize: 0},
'[data-variant="danger"]:hover &, [data-variant="danger"]:active &': {
color: getVariantStyles(variant, disabled, inactive).hoverColor,
},
'[data-variant="danger"]:not([aria-disabled]):not([data-inactive]):hover &, [data-variant="danger"]:active &':
{
color: getVariantStyles(variant, disabled, inactive).hoverColor,
},
},
sx as SxProp,
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ export const InactiveItems = () => (
<GearIcon />
</ActionList.LeadingVisual>
</ActionList.LinkItem>
<ActionList.Item onSelect={() => alert('Make a copy clicked')} inactiveText="Unavailable due to an outage">
<ActionList.Item
variant="danger"
onSelect={() => alert('Make a copy clicked')}
inactiveText="Unavailable due to an outage"
>
Make a copy
<ActionList.LeadingVisual>
<CopyIcon />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -652,7 +652,7 @@ exports[`snapshots renders a menu that contains an item to add to the menu 1`] =
font-size: 12px;
}
[data-variant="danger"]:hover .c4,
[data-variant="danger"]:not([aria-disabled]):not([data-inactive]):hover .c4,
[data-variant="danger"]:active .c9 {
color: var(--fgColor-default,var(--color-fg-default,#1F2328));
}
Expand Down

0 comments on commit b13bbb3

Please sign in to comment.