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

abs() sign() #867

Open
stubbornella opened this issue Oct 9, 2024 · 4 comments
Open

abs() sign() #867

stubbornella opened this issue Oct 9, 2024 · 4 comments
Labels
focus-area-proposal Focus Area Proposal

Comments

@stubbornella
Copy link

stubbornella commented Oct 9, 2024

Description

abs() and sign() would help developers create responsive animations and designs and add to the set of trigonometric, sign, and exponential functions we currently support.

Specification

https://drafts.csswg.org/css-values-4/#math

Tests

https://wpt.fyi/results/css/css-values?label=master&label=stable&product=chrome&product=firefox&product=safari&aligned&q=signs-abs

Additional Signals

Developers are asking that we fill out missing mathematical functions: https://css-tricks.com/using-absolute-value-sign-rounding-and-modulo-in-css-today/

@gsnedders
Copy link
Member

Note we previously had these in the Interop 2023 CSS Math Functions focus area (proposal: #149), which we decided to not carry over into 2024 (#462).

However, the stable results for that focus area show that Chrome still hasn't shipped abs and sign, and is still at 95%.

@gsnedders
Copy link
Member

https://issues.chromium.org/issues/40253181 covers the Chromium implementation; there's been nothing from anyone working on Chromium since the commit which moved the feature flag to "experimental" in 2023.

@danielsakhapov
Copy link

danielsakhapov commented Nov 1, 2024

I'd like to notice that all browser engines have the problem with sign() function used in non-length (e.g. numbers, degrees, ...) accepting properties when it has some relative units inside - sign(1em - 1px). That was the main reason Chromium hadn't shipped sign() function.

I'd like to include the following tests that cover the sign(...em...) situations:
https://wpt.fyi/css/css-sizing/aspect-ratio/sign-function-aspect-ratio.html
https://wpt.fyi/css/css-fonts/font-style-sign-function.html
https://wpt.fyi/css/css-inline/initial-letter/initial-letter-sign-function.html
https://wpt.fyi/css/mediaqueries/mq-calc-sign-function-003.html
https://wpt.fyi/css/mediaqueries/mq-calc-sign-function-004.html
https://wpt.fyi/css/mediaqueries/mq-calc-sign-function-005.html
https://wpt.fyi/css/filter-effects/animation/filter-interpolation-sign-function.html
https://wpt.fyi/css/filter-effects/filter-sign-function.html
https://wpt.fyi/css/css-viewport/zoom/zoom-with-sign-function.html
https://wpt.fyi/css/css-fonts/palette-mix-computed.html
https://wpt.fyi/css/css-transforms/transform-with-sign-function.html
https://wpt.fyi/css/css-color/parsing/color-valid-color-mix-function.html
https://wpt.fyi/css/motion/animation/ray-angle-interpolation-math-functions.html

Also, note, that some cases were added directly to https://wpt.fyi/css/css-values/signs-abs-computed.html

We still have some places where it's not fixed for Chromium, e.g. easing functions can have sign(...em...) in declaration, but that's lacking test coverage, so more tests will be added, once any browser fix it first with tests.

@gsnedders
Copy link
Member

https://wpt.fyi/css/css-inline/initial-letter/initial-letter-sign-function.html

This should probably be contingent on #830, as it wouldn't make sense for this to implicitly include features that don't otherwise have support everywhere. (i.e., you shouldn't have to implement initial-letter just to pass all the abs()/sign() tests!)

https://wpt.fyi/css/css-fonts/palette-mix-computed.html

This hasn't been proposed as a feature in its own right, and thus should likely the excluded, on the same basis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
focus-area-proposal Focus Area Proposal
Projects
Status: No status
Development

No branches or pull requests

3 participants