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

Incorrect reduction of clamp to min given a negative bound #836

Closed
alcore opened this issue Oct 16, 2024 · 1 comment
Closed

Incorrect reduction of clamp to min given a negative bound #836

alcore opened this issue Oct 16, 2024 · 1 comment

Comments

@alcore
Copy link

alcore commented Oct 16, 2024

Given the following...

margin: 100px clamp(-100px, 0px, 50% - 50vw)

... to set a negative horizontal margin when sufficient space is available in the container and viewport, while making sure it doesn't extrude more than 100px outwards (min of -100px) and does not get a positive margin inwards (max of 0px) from the dynamic calc.

LightningCSS (1.27) reduces that to:

margin: 100px min(0px, 50% - 50vw)

It gets correctly retained when the math is expressed by its equivalent instead:

margin: 100px max(-100px, min(0px, 50% - 50vw))
@alcore alcore changed the title Incorrect reduction of clamp to min given a 0px and a negative bound Incorrect reduction of clamp to min given a negative bound Oct 16, 2024
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

No branches or pull requests

4 participants
@alcore and others