Skip to content

Button: Do not add [data-size="medium"]` when size is explicitly specified as medium - #2929

Merged
broccolinisoup merged 3 commits into
mainfrom
button-medium-sx-override
Feb 23, 2023
Merged

Button: Do not add [data-size="medium"]` when size is explicitly specified as medium#2929
broccolinisoup merged 3 commits into
mainfrom
button-medium-sx-override

Conversation

@broccolinisoup

@broccolinisoupbroccolinisoup commented Feb 23, 2023

Copy link
Copy Markdown
Member

Describe your changes here.

Closes#2927

Context

The issue is when size="medium" prop is passed to Button, the styles provided via sx prop don't apply. With the way we apply Button styles that were provided via sx is described here.

Issue and solution

The reason that wasn't working for the size="medium" is because the function is adding [data-size="medium"] but we don't have any styles defined with that data-attribute (Because the default size of Button is medium therefore it is styled on the base class) so it was simply disregarding everything. Simply checking if the size is not equal to mediumsolves the issue.

Screenshots

No visual changes

Merge checklist

  • Added/updated documentation
  • Tested in Chrome
  • Tested in Firefox
  • Tested in Safari
  • Tested in Edge

Take a look at the What we look for in reviews section of the contributing guidelines for more information on how we review PRs.

@broccolinisoup
broccolinisoup requested review from a team and joshblackFebruary 23, 2023 02:25
@changeset-bot

changeset-botBot commented Feb 23, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0144037

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-actionsBot commented Feb 23, 2023

Copy link
Copy Markdown
Contributor

size-limit report 📦

PathSize
dist/browser.esm.js94.58 KB (+0.01% 🔺)
dist/browser.umd.js95.16 KB (+0.01% 🔺)

@github-actions
github-actionsBot temporarily deployed to storybook-preview-2929 February 23, 2023 02:31 Inactive
@broccolinisoup
broccolinisoup temporarily deployed to github-pages February 23, 2023 02:33 — with GitHub Actions Inactive
@github-actions
github-actionsBottemporarily deployed to storybook-preview-2929 February 23, 2023 02:34 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.

Thank you for this! 🚀

@broccolinisoup
broccolinisoup added this pull request to the merge queueFeb 23, 2023
Merged via the queue into main with commit ee4b76fFeb 23, 2023
@broccolinisoup
broccolinisoup deleted the button-medium-sx-override branch February 23, 2023 22:36
@primer-cssprimer-css mentioned this pull request Feb 23, 2023
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button style overrides for size medium break in 35.20

3 participants

@broccolinisoup@joshblack@langermank