Skip to content

ActionList: Fix leaky disabled description styles - #4566

Merged
siddharthkp merged 2 commits into
mainfrom
actionlist-fix-description-styles
May 13, 2024
Merged

ActionList: Fix leaky disabled description styles#4566
siddharthkp merged 2 commits into
mainfrom
actionlist-fix-description-styles

Conversation

@siddharthkp

@siddharthkpsiddharthkp commented May 7, 2024

Copy link
Copy Markdown
Member

Problem

Description in a disabled item should not have color: fg.muted but the disabled color. We set this by adding the disabled color on the item and adding color:inherit on the description. Source

conststyles={'li[aria-disabled="true"] &': {color: 'inherit'}}return<Boxas="span"sx={styles}/>{props.children</Box>

This feels safe because we are only targeting Description inside li[aria-disabled=true]. This is the generated css:

li[aria-disabled="true"] .Box-sc-g0xbh4-0 {
color: inherit;
}

The trouble here is that the generated className for '&' is not the className just for ActionList.Description but is passed to multiple elements within ActionList.Item. 🤔

This really threw me off!

the className Box-sc-g0xbh4-0 is present on multiple elements

Solution

As a quick fix, I added a data-component to make the selector more specific. Expecting no visual changes, only changes in the generated css.

Before
li[aria-disabled="true"] .Box-sc-g0xbh4-0 {
color: inherit;
}
After
li[aria-disabled="true"] .Box-sc-g0xbh4-0[data-component="ActionList.Description"] {
color: inherit;
}

Rollout strategy

  • Patch release
  • Minor release
  • Major release; if selected, include a written rollout or migration plan
  • None; if selected, include a brief description as to why

Testing & Reviewing

Merge checklist

@changeset-bot

changeset-botBot commented May 7, 2024

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e995bb9

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

This PR includes changesets to release 1 package
NameType
@primer/reactPatch

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
github-actionsBottemporarily deployed to storybook-preview-4566 May 7, 2024 13:48 Inactive
@github-actions

github-actionsBot commented May 7, 2024

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
packages/react/dist/browser.esm.js88.07 KB (+0.04% 🔺)
packages/react/dist/browser.umd.js88.43 KB (+0.06% 🔺)

@siddharthkpsiddharthkp self-assigned this May 7, 2024
@siddharthkpsiddharthkp added bug Something isn't working patch release bug fixes, docs, housekeeping labels May 7, 2024
@siddharthkp
siddharthkp marked this pull request as ready for review May 7, 2024 14:50
@siddharthkp
siddharthkp requested a review from a team as a code ownerMay 7, 2024 14:50
@github-actions
github-actionsBottemporarily deployed to storybook-preview-4566 May 7, 2024 14:51 Inactive

@langermanklangermank left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

// huh why?

😄

@joshblackjoshblack left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@siddharthkp wanted to ask if this is possible to capture in VRT or nah? (Or is it already?)

@siddharthkp

siddharthkp commented May 8, 2024

Copy link
Copy Markdown
MemberAuthor

wanted to ask if this is possible to capture in VRT or nah? (Or is it already?)

Maybe but not a clean one. The instance where this happens in gh/gh is also not the best use case for ActionList

@siddharthkp
siddharthkp added this pull request to the merge queueMay 13, 2024
Merged via the queue into main with commit 4dd6befMay 13, 2024
@siddharthkp
siddharthkp deleted the actionlist-fix-description-styles branch May 13, 2024 14:39
@primerprimerBot mentioned this pull request May 9, 2024
JelloBagel pushed a commit that referenced this pull request May 16, 2024
* replace leaky & with data-component
* Create stupid-stingrays-sparkle.md
@primer-integration

Copy link
Copy Markdown

👋 Hi from github/github! Your integration PR is ready: https://github.com/github/github/pull/false

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugSomething isn't workingpatch releasebug fixes, docs, housekeeping

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@siddharthkp@joshblack@langermank