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

[css-typed-om] 'fr' units cannot be used in a calc #734

Closed
darrnshn opened this issue Mar 18, 2018 · 6 comments
Closed

[css-typed-om] 'fr' units cannot be used in a calc #734

darrnshn opened this issue Mar 18, 2018 · 6 comments

Comments

@darrnshn
Copy link
Collaborator

It seems like you can't use 'fr' units in a calc, but you can create a CSSMathValue containing CSSUnitValues with fr units. Is this going to change? If not, we should handle this case (maybe throw an exception when trying to create a CSSMathValue with fr units?)

@tabatkins
Copy link
Member

I think that's accidental - we just made an explicit list of types at one point, and fr units were added after that point, and we never thought to add it. I'm asking @fantasai for confirmation; if so, I'll just fix calc() to allow fr units.

@fantasai
Copy link
Contributor

fantasai commented Mar 21, 2018

You spent a lot of effort arguing that the spec didn't allow fr units inside calc(), y'know. :) In any case it was resolved not to by the CSSWG in w3c/csswg-drafts#955 Minutes at https://lists.w3.org/Archives/Public/www-style/2017Mar/0060.html

@tabatkins
Copy link
Member

No, I argued that fr couldn't be combined with <length>, which is still correct. But right now calc(1fr / 7) is disallowed, which seems like an inadvertant omission rather than a purposeful one.

@tabatkins
Copy link
Member

Agenda+ to confirm that allowing 'fr' units in calc() (not combinable with anything, just on their own) is okay (and V&U should change as a result).

@tabatkins
Copy link
Member

Whoops, w3c/csswg-drafts#2665 points out the <resolution> units aren't currently allowed in calc() either. We should make that possible as well.

(Like <flex>, they'll just be usable by themselves. In particular, <resolution> values are not inverse <length>s.)

@css-meeting-bot
Copy link
Member

The Working Group just discussed 'fr' units cannot be used in a calc, and agreed to the following:

  • RESOLVED: Allow fr and resolution units in calc functions, add a not to V&U explaining they don't combine with length
  • RESOLVED: Add a note to CSS Values that new unit value types should be added to calc as they're added to CSS
The full IRC log of that discussion <dael> Topic: 'fr' units cannot be used in a calc
<dael> github: https://github.com//issues/734
<dael> TabAtkins: When typed OM defined math rules treated fr like any other type
<dael> TabAtkins: YOu can devide a resolution by 2 for example. Anything else added confusion. But looking at value spec fr and resolution aren't allowed in calc.
<dael> TabAtkins: Seems like not it's a purposeful limitation. I think the types were added to V&U after calc. Given you can express them in typed om I'd like to be able to express in calc. Or go back to typed OM and say no you can't use these. That's oddly limiting. Proposal is allow fr units and resolution units in calc. They are independant units.
<dael> dbaron: I think we have resolutions to allow more unit algebra in calc.
<dael> TabAtkins: [missed]
<dael> dbaron: Then they're their own type in the unit algebra.
<dael> TabAtkins: Yes. fr doesn't add to length, though. but you can combine as long as end result is a reasonable unit.
<dael> Rossen_: Soulds reasonable. Other opinions?
<dbaron> I'm in favor.
<dael> AmeliaBR: I'd ask that maybe somewhere there's an informative note emphasizing fr can't be added and combined with length and %.
<dael> TabAtkins: I think that's a note in grid. If not, I'm happy to add it.
<dael> AmeliaBR: Sounds good.
<dael> Rossen_: I think V&U is good for this note.
<dbaron> That said, it seems like we might want to be able to add in the future...
<dael> Rossen_: Anything besides the note. Other ideas or objections?
<dael> RESOLVED: Allow fr and resolution units in calc functions, add a not to V&U explaining they don't combine with length
<dael> TabAtkins: Do we want a standing resolution that any new numeric units should add to calc?
<dael> chrisl: I'd rather exceptions on case by case basis.
<dael> TabAtkins: Agree.
<dael> Rossen_: Sounds reasonable. It's not like we add numeric that often
<dael> dbaron: Agree new numeric values should be supported by calc.
<dael> Rossen_: Separate resolution for CSS Values that adds a note that numeric values are supported by defualt in calc
<dael> TabAtkins: New unit value types should be added to calc as they're added to CSS
<dael> Rossen_: Obj?
<dael> RESOLVED: Add a note to CSS Values that new unit value types should be added to calc as they're added to CSS

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

4 participants