Open Bug 1866236 Opened 10 months ago Updated 9 months ago

Support CSS math functions on flexible lengths

Categories

(Core :: CSS Parsing and Computation, enhancement, P3)

Firefox 121
enhancement

Tracking

()

UNCONFIRMED

People

(Reporter: kizmarh, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5666.197 Safari/537.36

Steps to reproduce:

Go to https://codepen.io/kizu/pen/RwvyyOg or try using calc(1fr) in grid-template-columns

Actual results:

The calc(1fr) is treated as invalid

Expected results:

The calc(1fr) should be valid, as per specs (see it for the <flex> type):

https://drafts.csswg.org/css-values-4/#calc-type-checking

and as clarified by the spec editors:

https://github.com/w3c/csswg-drafts/issues/6989

Definitely a bug; fr units should be math'able just fine. That note is, indeed, just observing that fr is not a <length> so calc(1px + 1fr) is invalid, but calc(1fr / 3) should be just fine.

Curiously, no other browser did fix this yet. Chromium has a bug open from 2019: https://bugs.chromium.org/p/chromium/issues/detail?id=993136&q=calc%20fr&can=2 and I did not find a bug for WebKit (would fill it after this one).

And cross-linking the WebKit bug: https://bugs.webkit.org/show_bug.cgi?id=265276 just in case

The Bugbug bot thinks this bug should belong to the 'Core::CSS Parsing and Computation' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core

I did open a PR adding WPT tests for this: https://github.com/web-platform-tests/wpt/pull/43322

The severity field is not set for this bug.
:emilio, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(emilio)
Severity: -- → S3
Type: defect → enhancement
Flags: needinfo?(emilio)
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.