Skip to content

Commit

Permalink
ActionList: Fix leaky disabled description styles (#4566)
Browse files Browse the repository at this point in the history
* replace leaky & with data-component

* Create stupid-stingrays-sparkle.md
  • Loading branch information
siddharthkp authored May 13, 2024
1 parent 4ecbe1a commit 4dd6bef
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
5 changes: 5 additions & 0 deletions .changeset/stupid-stingrays-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@primer/react": patch
---

ActionList: Fix leaky description styles for disabled item
17 changes: 5 additions & 12 deletions packages/react/src/ActionList/Description.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,15 @@ export const Description: React.FC<React.PropsWithChildren<ActionListDescription
minWidth: 0,
marginLeft: variant === 'block' ? 0 : 2,
color: 'fg.muted',
'li[aria-disabled="true"] &': {
color: 'inherit',
},
'li[data-variant="danger"]:hover &, li[data-variant="danger"]:active &': {
color: 'inherit',
},
'li[aria-disabled="true"] &[data-component="ActionList.Description"]': {color: 'inherit'},
'li[data-variant="danger"]:hover &[data-component="ActionList.Description"], li[data-variant="danger"]:active &[data-component="ActionList.Description"]':
{color: 'inherit'},
}

const {blockDescriptionId, inlineDescriptionId} = React.useContext(ItemContext)

return variant === 'block' ? (
<Box
as="span"
// huh why?
sx={merge(styles, sx as SxProp)}
id={blockDescriptionId}
>
<Box as="span" sx={merge(styles, sx as SxProp)} id={blockDescriptionId} data-component="ActionList.Description">
{props.children}
</Box>
) : (
Expand All @@ -54,6 +46,7 @@ export const Description: React.FC<React.PropsWithChildren<ActionListDescription
title={props.children as string}
inline={true}
maxWidth="100%"
data-component="ActionList.Description"
>
{props.children}
</Truncate>
Expand Down

0 comments on commit 4dd6bef

Please sign in to comment.