Skip to content

Conversation

@philipp-spiess
Copy link
Member

@philipp-spiess philipp-spiess commented Nov 11, 2024

Closes #14960

When we moved to the --spacing multiples scale, we seemingly overlooked a bail that caused us to use non-numerical values as a spacing multiple. This caused the -translate-x-full and -translate-y-full utilities to treat full as a valid multiple in our spacing scale and created invalid CSS:

.-translate-x-full {
  --tw-translate-x: calc(var(--spacing) * -x-full);
  --tw-translate-y: calc(var(--spacing) * -x-full);
  translate: var(--tw-translate-x) var(--tw-translate-y);
}

Test plan

I reproduced the issue in our Vite playground and then created a failing test case. It requires a --spacing @theme variable to be defined so I've added this as a test case now in the unit tests. I also audited all places that are using calc() and wrapping some numbers. In doing so I found a few other broken cases:

  • -translate-x-full
  • -translate-y-full
  • -space-x-full
  • -space-y-full
  • -inset-full

I validated that the fix indeed works and no longer creates broken CSS definitions for these cases:

Screenshot 2024-11-11 at 19 33 51

@philipp-spiess philipp-spiess force-pushed the fix/validate-negative-spacing-bare-value-support branch 2 times, most recently from 19805c3 to e246292 Compare November 11, 2024 18:10
@philipp-spiess philipp-spiess force-pushed the fix/validate-negative-spacing-bare-value-support branch from 9003b72 to 9e571fb Compare November 11, 2024 18:39
@philipp-spiess philipp-spiess marked this pull request as ready for review November 11, 2024 18:39
@philipp-spiess philipp-spiess requested a review from a team as a code owner November 11, 2024 18:39
@adamwathan adamwathan merged commit 98c279d into next Nov 11, 2024
1 check passed
@adamwathan adamwathan deleted the fix/validate-negative-spacing-bare-value-support branch November 11, 2024 18:45
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.

v4 alpha.32 translate regression

3 participants