Skip to content

fix(sass): replace the remaining legacy if() calls - #24070

Open
aklkv wants to merge 1 commit into
carbon-design-system:mainfrom
aklkv:fix/motion-sass-if-deprecation
Open

aklkv wants to merge 1 commit into
carbon-design-system:mainfrom
aklkv:fix/motion-sass-if-deprecation

Conversation

@aklkv

@aklkv aklkv commented Nov 16, 2026

Copy link
Copy Markdown

Closes #24069

Sass 1.95 deprecates the legacy if() function, and this replaces the eleven calls still left in @carbon/motion, @carbon/styles and the action set web component. Motion's two error-message fallbacks use or; the rest use @if/@else, as #21305 did for tooltip. Both work in every Sass version @carbon/styles supports (^1.33.0), which the new if(sass(...)) syntax doesn't.

Changelog

New

  • A motion test for the error an inline surface without a duration raises

Changed

  • Replaced the legacy if() calls in motion's -validate-reveal, the card, popover, toggletip and tooltip styles, and the action set web component. The compiled CSS doesn't change.

Removed

  • None

Testing / Reviewing

  • I compiled packages/styles/index.scss before and after, with enable-v12-release off and on. The CSS is byte-identical both ways, and the flag still changes the values these files set (the popover radius is 2px without it, 0.5rem with it).
  • The action set's button-separator mixin gives the same CSS for its default, horizontal and vertical directions.
  • $x or 'nothing' gives the same result as if($x, $x, 'nothing') for a string, null and false, on sass 1.33.0 and 1.108.2.
  • yarn jest packages/motion/__tests__/motion-test.js passes, including the new case.
  • To see the warnings go away, compile a file that loads these with sass 1.95 or later, for example @use '@carbon/motion';. The repo's lockfile has 1.93.2, which doesn't warn.

PR Checklist

As the author of this PR, before marking ready for review, confirm you:

  • Reviewed every line of the diff
  • Updated documentation and storybook examples (nothing user-facing changes)
  • Followed the required v12 migration documentation for any code change that affects v12, or struck through this item because the PR does not affect v12 (the v12 output is unchanged)
  • Wrote passing tests that cover this change
  • Addressed any impact on accessibility (a11y) (no visual or behaviour change)
  • Tested for cross-browser consistency (identical CSS)
  • Validated that this code is ready for review and status checks should pass

More details can be found in the pull request guide.

Sass 1.95 deprecates the legacy if() function, so builds on it warn for
every call left in `@carbon/motion`, `@carbon/styles` and the action set
web component. Use `or` for the fallbacks in motion's error messages and
@if/@else elsewhere, which every supported Sass version understands. The
compiled CSS doesn't change.

Signed-off-by: Alexey Kulakov <uni_que@me.com>
@aklkv
aklkv requested a review from a team as a code owner November 16, 2026 19:42
@netlify

netlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for v12-carbon-web-components ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a2c5c67
🔍 Latest deploy log https://app.netlify.com/projects/v12-carbon-web-components/deploys/6afb5ca550d91a9001840328
😎 Deploy Preview https://deploy-preview-24070--v12-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for v12-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a2c5c67
🔍 Latest deploy log https://app.netlify.com/projects/v12-carbon-react/deploys/6afb5ca5e20c083b0d3f1b4f
😎 Deploy Preview https://deploy-preview-24070--v12-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your submission! We ask that you sign our Developer Certificate of Origin before we can accept your contribution. You can sign the DCO by adding a comment below using this text:


I have read the DCO document and I hereby sign the DCO.


You can retrigger this bot by commenting recheck in this Pull Request. Posted by the DCO Assistant Lite bot.

@netlify

netlify Bot commented Nov 16, 2026

Copy link
Copy Markdown

✅ Deploy Preview for v11-carbon-react ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a2c5c67
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-react/deploys/6afb5ca500777cbd11b886fb
😎 Deploy Preview https://deploy-preview-24070--v11-carbon-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 16, 2026

Copy link
Copy Markdown

✅ Deploy Preview for v11-carbon-web-components ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a2c5c67
🔍 Latest deploy log https://app.netlify.com/projects/v11-carbon-web-components/deploys/6afb5ca501eb4224486a03a4
😎 Deploy Preview https://deploy-preview-24070--v11-carbon-web-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify

netlify Bot commented Nov 16, 2026

Copy link
Copy Markdown

✅ Deploy Preview for carbon-elements ready!

Name Link
🔨 Latest commit a2c5c67
🔍 Latest deploy log https://app.netlify.com/projects/carbon-elements/deploys/6afb5ca5dafbcffa87e4bfab
😎 Deploy Preview https://deploy-preview-24070--carbon-elements.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

This branch has not been deployed

No deployments
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.

[Bug]: Sass if() deprecation warnings from @carbon/motion and @carbon/styles

1 participant