Skip to content

Commit b13bbb3

Browse files
authored
Prevents text color from changing on hover for "inactive" ActionMenu.Items of the "danger" variant (#4651)
* prevents inactive danger actionmenu items from changing color on hover * adds changeset
1 parent 623b16e commit b13bbb3

File tree

4 files changed

+15
-5
lines changed

4 files changed

+15
-5
lines changed

.changeset/honest-olives-laugh.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@primer/react': patch
3+
---
4+
5+
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.

packages/react/src/ActionList/Visuals.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,10 @@ export const LeadingVisual: React.FC<React.PropsWithChildren<VisualProps>> = ({s
3838
{
3939
color: getVariantStyles(variant, disabled, inactive).iconColor,
4040
svg: {fontSize: 0},
41-
'[data-variant="danger"]:hover &, [data-variant="danger"]:active &': {
42-
color: getVariantStyles(variant, disabled, inactive).hoverColor,
43-
},
41+
'[data-variant="danger"]:not([aria-disabled]):not([data-inactive]):hover &, [data-variant="danger"]:active &':
42+
{
43+
color: getVariantStyles(variant, disabled, inactive).hoverColor,
44+
},
4445
},
4546
sx as SxProp,
4647
)}

packages/react/src/ActionMenu/ActionMenu.features.stories.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,11 @@ export const InactiveItems = () => (
158158
<GearIcon />
159159
</ActionList.LeadingVisual>
160160
</ActionList.LinkItem>
161-
<ActionList.Item onSelect={() => alert('Make a copy clicked')} inactiveText="Unavailable due to an outage">
161+
<ActionList.Item
162+
variant="danger"
163+
onSelect={() => alert('Make a copy clicked')}
164+
inactiveText="Unavailable due to an outage"
165+
>
162166
Make a copy
163167
<ActionList.LeadingVisual>
164168
<CopyIcon />

packages/react/src/__tests__/__snapshots__/Autocomplete.test.tsx.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ exports[`snapshots renders a menu that contains an item to add to the menu 1`] =
652652
font-size: 12px;
653653
}
654654
655-
[data-variant="danger"]:hover .c4,
655+
[data-variant="danger"]:not([aria-disabled]):not([data-inactive]):hover .c4,
656656
[data-variant="danger"]:active .c9 {
657657
color: var(--fgColor-default,var(--color-fg-default,#1F2328));
658658
}

0 commit comments

Comments
 (0)