Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove unitless calc addition for when postcss-calc is not included #4234

Merged
merged 2 commits into from
May 28, 2021

Conversation

alex-page
Copy link
Member

Co-Authored-By: Ben Scott 227292+BPScott@users.noreply.github.com

WHY are these changes introduced?

Fixes #4232

WHAT is this pull request doing?

Unitless calc was breaking when users did not provide postcss-calc as a plugin. This fixes the outline on components like <Button plain> where the output of the focusring mixin was calc(0 + 1rem).

How to 馃帺

Remove this from ./storybook/main.js

https://github.com/Shopify/polaris-react/blob/9081df8bde8c682240fbc1cccba35bb5dbdd6d08/.storybook/main.js#L57-L63

Then open the plain button example.

馃帺 checklist

  • Tested on mobile
  • Tested on multiple browsers
  • Tested for accessibility
  • Updated the component's README.md with documentation changes
  • Tophatted documentation changes in the style guide
  • For visual design changes, pinged one of @鈥奌YPD, @鈥妋irualves, @鈥妔arahill, or @鈥妑y5n to update the Polaris UI kit

Co-Authored-By: Ben Scott <227292+BPScott@users.noreply.github.com>
@alex-page alex-page requested a review from BPScott as a code owner May 27, 2021 23:02
@alex-page alex-page self-assigned this May 27, 2021
Co-Authored-By: Ben Scott <227292+BPScott@users.noreply.github.com>
@BPScott
Copy link
Member

BPScott commented May 27, 2021

Turns out calc(0 + 1rem) is error in browsers. However postcss-calc is totally fine with simplifying it down to calc(1rem).

This PR includes an update to @shopify/postcss-plugin which we thought might be a fix along the way. Turns out it wasn't the root cause but hey we might as well keep it anyway.

@github-actions
Copy link
Contributor

github-actions bot commented May 27, 2021

size-limit report

Path Size
cjs 141.86 KB (0%)
esm 95.43 KB (0%)
esnext 138.62 KB (+0.04% 馃敽)
css 33.72 KB (+0.12% 馃敽)

Copy link
Contributor

@kyledurand kyledurand left a comment

Choose a reason for hiding this comment

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

Code looks good, did a quick 馃帺 as well just in case

@alex-page alex-page merged commit 60825e3 into main May 28, 2021
@alex-page alex-page deleted the rm-unitless-calc-addition branch May 28, 2021 00:40
Sign up for free to 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.

Focus box is mis-sized when using unminified Polaris CSS
3 participants