Content-Length: 267453 | pFad | http://github.com/w3c/csswg-drafts/issues/11825

46 [css-values-4] Should progress() functions clamp to 0-100%? · Issue #11825 · w3c/csswg-drafts · GitHub
Skip to content

[css-values-4] Should progress() functions clamp to 0-100%? #11825

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

Open
fantasai opened this issue Mar 4, 2025 · 6 comments
Open

[css-values-4] Should progress() functions clamp to 0-100%? #11825

fantasai opened this issue Mar 4, 2025 · 6 comments

Comments

@fantasai
Copy link
Collaborator

fantasai commented Mar 4, 2025

A lot of use cases for the progress functions require clamping the value to 0-100%. Some use cases don't... but the driving use cases generally do.

Should progress() clamp to 0-100% by default? It's always possible to get the unclamped result by using calc().

If it doesn't, then authors will need to manually clamp it all the time, which probably gets annoying, especially since you need to repeat the start/end values. clamp(0%, progress(_value_, 0%, 100%), 100%)...

@Loirooriol
Copy link
Contributor

I wouldn't clamp, just like for #6701

It would seem very weird to me if progress(200px, 0px, 100px) was 1 despite 200px being farther than 100px from 0px.

@kizu
Copy link
Member

kizu commented Mar 7, 2025

This is something I thought about, and in the use cases where I tried progress(), I always wanted it to be clamped. And wrapping something with clamp(0, progress(), 1) was a bit cumbersome.

I wonder if we can make this to be controlled by an optional keyword inside progress()?

Like progress(clamped, 200px, 0px, 100px) if it is not clamped by default, or something like progress(full, 200px, 0px, 100px) if we decide to clamp by default.

Even without default clamping, having a keyword for this common case will be better than manually clamping. Personally, I would prefer to optimize for the more common use cases. But that's not a strong preference.

@fantasai
Copy link
Collaborator Author

fantasai commented Mar 7, 2025

Maybe progress() and unlimited-progress() ?

@Crissov
Copy link
Contributor

Crissov commented Mar 8, 2025

It feels like there was a single word for unlimited progress, advance() perhaps?

@jensimmons
Copy link
Contributor

As I started to use progress(), I was quite surprised that it doesn't clamp. I believe it should be clamped! If an author wants to open it up, they can easily set a wider range.

@Loirooriol
Copy link
Contributor

they can easily set a wider range

What do you mean? Let's say I want to know how far var(--x) is from 100px, compared with 200px. So for --x: 300px I expect 200% since it's twice as far. What wider range should I use?

It seems to me that the opposite is true: if the result is not clamped and you want it clamped, you can trivially clamp it with clamp(). But if the result is clamped and you don't want it clamped, then progress() is basically useless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/w3c/csswg-drafts/issues/11825

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy