-
Notifications
You must be signed in to change notification settings - Fork 538
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
Corrects styling on Button
s that only have a count
and icon
#5448
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 07f8bc9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Uh oh! @mperrotti, the image you shared is missing helpful alt text. Check your pull request body. Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
👋 Hi, this pull request contains changes to the source code that github/github depends on. If you are GitHub staff, we recommend testing these changes with github/github using the integration workflow. Thanks! |
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed on Slack and summarizing my thoughts here!
I would suggest putting this logic in Button
to avoid adding a wrapper span inside IconButton
. In order to utilize Button's layout wrapper .ButtonContent
we're adding it to IconButton
which feels like its adding unnecessary complexity given that this already exists in Button
😄
I would suggest...
- Add a data-attribute to
ButtonBase
whencount
is truedata-has-count
for example - Add a CSS selector
&:where([data-has-count])
and check if.Label
is not there (not has?) - Remove padding if has count is true,
.Label
is not present. You could also check that a leading visual is present but I'm not sure that's necessary
If this doesn't work out I would feel better about that span being conditional in IconButton!
Uh oh! @mperrotti, the image you shared is missing helpful alt text. Check your pull request body. Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
count
prop to IconButtonButton
s that only have a count
and icon
Uh oh! @mperrotti, the image you shared is missing helpful alt text. Check your pull request body. Alt text is an invisible description that helps screen readers describe images to blind or low-vision users. If you are using markdown to display images, add your alt text inside the brackets of the markdown image. Learn more about alt text at Basic writing and formatting syntax: images on GitHub Docs.
|
&:where([data-has-count]):has([data-component='leadingVisual']):not(:has([data-component='text'])) { | ||
padding-inline: var(--control-medium-paddingInline-condensed); | ||
|
||
&:where([data-size='small']) { | ||
padding-inline: var(--control-xsmall-paddingInline-condensed); | ||
} | ||
|
||
&:where([data-size='large']) { | ||
padding-inline: var(--control-large-paddingInline-normal); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
&:where([data-has-count]):has([data-component='leadingVisual']):not(:has([data-component='text'])) { | |
padding-inline: var(--control-medium-paddingInline-condensed); | |
&:where([data-size='small']) { | |
padding-inline: var(--control-xsmall-paddingInline-condensed); | |
} | |
&:where([data-size='large']) { | |
padding-inline: var(--control-large-paddingInline-normal); | |
} | |
} | |
&:where([data-has-count]):has([data-component='leadingVisual']):not(:has([data-component='text'])) { | |
/* stylelint-disable-next-line primer/spacing */ | |
padding-inline: var(--control-medium-paddingInline-condensed); | |
&:where([data-size='small']) { | |
/* stylelint-disable-next-line primer/spacing */ | |
padding-inline: var(--control-xsmall-paddingInline-condensed); | |
} | |
&:where([data-size='large']) { | |
/* stylelint-disable-next-line primer/spacing */ | |
padding-inline: var(--control-large-paddingInline-normal); | |
} | |
} |
I think this will work for lint but the formatting might be off
export const TrailingCounterWithNoText = () => { | ||
return <Button leadingVisual={CommentIcon} count={3} /> | ||
} | ||
export const TrailingCounterWithNoText = () => <Button leadingVisual={CommentIcon} count={3} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we add an aria-label or a Tooltip to this example?
You'll need to remove the snapshots that were added, and if you want add a new VRT test for the feature story 👍 |
Closes https://github.com/github/primer/issues/4501
Changelog
New
<Button>
where there is only an icon and a counter label to closer align with<IconButton>
sizingChanged
Nothing
Removed
Nothing
Rollout strategy
Testing & Reviewing
Confirm that this change doesn't cause any regressions with existing IconButton behavior.
Merge checklist