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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[styles]: Undefined carbon--mini-units Sass function is left in compiled CSS in some bundler configurations #11958

Closed
2 tasks done
m4olivei opened this issue Aug 2, 2024 · 0 comments · Fixed by #11964
Closed
2 tasks done
Assignees
Labels
bug Something isn't working dev Needs some dev work package: styles Work necessary for the Carbon for IBM.com styles package

Comments

@m4olivei
Copy link
Contributor

m4olivei commented Aug 2, 2024

Description

The @carbon/ibmdotom-styles package is still using carbon--mini-units in a few places, which was removed from Carbon v11.

In our case, this leads to carbon--mini-units being left in the compiled CSS. This leads to an invalid style rule, which the browser will ignore and depedning on the style rule causes unintended visual regressions in some situations.

Component(s) impacted

Any component that has a leftover carbon--mini-units function call. There are 30 occurrences of it's use, one of which is in /scss/globals/utils/_content-width.scss used by a few components.

image

Browser

Chrome

Carbon for IBM.com version

v2.11.1

Severity

Severity 2 = Aspects of design is broken, and impedes users in a significant way, but there is a way to complete their tasks. Affects major functionality, has a workaround.

Application/website

ibm.com

Package

@carbon/ibmdotcom-styles

CodeSandbox example

https://stackblitz.com/edit/vitejs-vite-xbadyn?file=main.scss

Steps to reproduce the issue (if applicable)

Bundle styles from the @carbon/ibmdotcom-styles packages, including one or more components that use carbon--mini-units directly or indirectly.

Expected

The expected length CSS value is rendered to the styles.

Also inspecting the compiled CSS should reveal no instances of carbon--mini-units.

Actual

We get styles like min-block-size: carbon--mini-units(20); in the compiled CSS. This is invalid CSS and leads to visual regressions for certain components in certain situations.

You can see this in the linked Stackblitz. Inspect the page, open main.scss in the Sources panel and notice how carbon--mini-units is in the output. Alternatively, in the Stackblitz terminal, run npm run build, then open the compiled CSS under the dist/ folder. Search for carbon--mini-units and notice that its in a few places in the compiled output.

Release date (if applicable)

No response

Code of Conduct

@m4olivei m4olivei added bug Something isn't working dev Needs some dev work package: styles Work necessary for the Carbon for IBM.com styles package labels Aug 2, 2024
@m4olivei m4olivei self-assigned this Aug 2, 2024
@kodiakhq kodiakhq bot closed this as completed in #11964 Aug 7, 2024
kodiakhq bot pushed a commit that referenced this issue Aug 7, 2024
### Related Ticket(s)

Closes #11958

### Description

Replaces `carbon--mini-units`, which is no longer part of Carbon v11, with the equivalent `$spacing-*` token, or `to-rem` call for the intended pixel size.

### Changelog

**Changed**

- Replaces all `carbon--mini-units` calls with v11 equivalent.

<!-- React and Web Component deploy previews are enabled by default. -->
<!-- To enable additional available deploy previews, apply the following -->
<!-- labels for the corresponding package: -->
<!-- *** "test: e2e": Codesandbox examples and e2e integration tests -->
<!-- *** "package: services": Services -->
<!-- *** "package: utilities": Utilities -->
<!-- *** "RTL": React / Web Components (RTL) -->
<!-- *** "feature flag": React / Web Components (experimental) -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dev Needs some dev work package: styles Work necessary for the Carbon for IBM.com styles package
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant