Re: [csswg-drafts] [css-values] Make top-level NaN be invalid at computed value time instead of ∞ (#7067)

The CSS Working Group just discussed `[css-values] Make top-level NaN be invalid at computed value time instead of ∞`.

<details><summary>The full IRC log of that discussion</summary>
&lt;fantasai> topic: [css-values] Make top-level NaN be invalid at computed value time instead of ∞<br>
&lt;fantasai> github: https://github.com/w3c/csswg-drafts/issues/7067<br>
&lt;fantasai> TabAtkins: When we added the ability to do arbitrary unit math to calc(), we introduced the ability to divide by zero<br>
&lt;fantasai> TabAtkins: these turn into infinities, fine, handle as large number<br>
&lt;fantasai> TabAtkins: We also introduced Nans, though<br>
&lt;fantasai> TabAtkins: We don't now how to make those behave<br>
&lt;fantasai> TabAtkins: We can't know what author intended without inspecting code<br>
&lt;fantasai> TabAtkins: so need to do something arbitrary to Nan<br>
&lt;fantasai> TabAtkins: Current spec turns NaN into infinity if it escapes a calc() function<br>
&lt;fantasai> TabAtkins: I chose this because a) Nan is definite an authoring error, always a mistake<br>
&lt;fantasai> TabAtkins: b) infinite is the most likely value to look wrong if you're doing something with this<br>
&lt;fantasai> TabAtkins: We have an unofficial policy throughout CSS, whenever we have a situation that can't detect at parse time, but is obviously a mistake<br>
&lt;lea> q?<br>
&lt;lea> q+<br>
&lt;fantasai> TabAtkins: we make it break in an obvious way, so that author is more likely to notice the mistake<br>
&lt;emilio> q+<br>
&lt;fantasai> TabAtkins: rather than doing something more sublte, that might be missed<br>
&lt;fantasai> TabAtkins: This came up during TAG review, and Lea suggested that it's better handled as "invalid at computed value time" behavior<br>
&lt;fantasai> TabAtkins: I don't have a strong opinion on this<br>
&lt;fantasai> TabAtkins: my only objection to changing behaving time is that it won't be invalid at computed value time, might not know it's invalid until *used* value time<br>
&lt;Rossen_> q<br>
&lt;fantasai> TabAtkins: so similar to IVACT, but distinct<br>
&lt;fantasai> TabAtkins: And whatever effect it has would behave differently wrt inheritance, for example<br>
&lt;fantasai> TabAtkins: The other reason is that I think IVACT behavior is less likely to be noticeable<br>
&lt;fantasai> TabAtkins: It's less likely to be obviously wrong, compared to treating as infinity<br>
&lt;fantasai> TabAtkins: I think Nan should break things as much as we possibly can<br>
&lt;fantasai> TabAtkins: and would be useful for authors to give them the more broken rendering<br>
&lt;fantasai> TabAtkins: but open for discussion<br>
&lt;emilio> ack fantasai<br>
&lt;Rossen_> ack fantasai<br>
&lt;Rossen_> ack lea<br>
&lt;fantasai> lea: I don't remember most of the arguments from TAG review, but think there's a more fundamental principle here<br>
&lt;fantasai> lea: errors don't always arise from authoring, sometimes from user-generated or other variable input<br>
&lt;fantasai> lea: and user will be first to see this<br>
&lt;fantasai> lea: I want to avoid making the website undreadable<br>
&lt;fantasai> lea: For things like layout, can be very bad<br>
&lt;lea> q?<br>
&lt;fantasai> lea: I'm not opposed, but problem with infinity because it would introduce really bad breakage, would be seen by users first<br>
&lt;Rossen_> q?<br>
&lt;oriol> q+<br>
&lt;fantasai> TabAtkins: I don't agree that invalid at computed value time is less likely to break<br>
&lt;Rossen_> q+<br>
&lt;fantasai> TabAtkins: if you're specifying a width as a calc(), that's going to be some specific value. If at some point, because using variables, results in a Nan and becomes invalid at computed time, that'll switch to 'auto'<br>
&lt;fantasai> TabAtkins: which is just as completely different from author's intent as infinity is<br>
&lt;fantasai> TabAtkins: we cannot divine an intent from a Nan<br>
&lt;miriam> q+<br>
&lt;fantasai> lea: Width: auto might produce a layout that's not intended, but not the same level as breakage as infinity<br>
&lt;fantasai> lea: which can stretch out of the viewport and make content unreadable<br>
&lt;fantasai> emilio: I was going to point out what Tab pointed out, that we still have an issue of what happens if NaN happens at used value time<br>
&lt;fantasai> emilio: I'm not a fan of introducing behavior that depends on cascade before/after<br>
&lt;fantasai> emilio: if we detect NaN at computed value or used value time...<br>
&lt;fantasai> emilio: As for what specific behavior, I don't have a super strong opinion<br>
&lt;fantasai> emilio: When we define NaNs in ..., we normalize to zero.<br>
&lt;fantasai> emilio: Usually just happens in testcases<br>
&lt;Rossen_> ack emilio<br>
&lt;iank_> we can only really determine this stuff at used value time.<br>
&lt;fantasai> emilio: I don't think it will matter in practice<br>
&lt;fantasai> emilio: I think zero is a bit more reasonable, doesn't create infinite scrollbars<br>
&lt;fantasai> emilio: I think I'm not a fan of the 2 different behaviors based on when you find the NaN<br>
&lt;miriam> q-<br>
&lt;fantasai> oriol: I'm not a big fan of the currently-specified behavior of treating NaN as positive infinity, which seems arbitrary to me<br>
&lt;fantasai> oriol: That's why I filed this issue to try to choose something closer to invalid at computed value time<br>
&lt;fantasai> oriol: During discusison realized this would be a problem for properties that have multiple components<br>
&lt;fantasai> oriol: Maybe only one of these is NaN<br>
&lt;fantasai> oriol: And sometimes we turn these properties into shorthands,<br>
&lt;TabAtkins> If it's infinity specifically that bugs people, I can go with "treat as 0".<br>
&lt;Rossen_> ack oriol<br>
&lt;fantasai> oriol: If we invalidate the entire property now, and later turn it into a shorthand, then we would only invalidate specific longhands<br>
&lt;TabAtkins> Just as likely to be wrong, but less likely to pop scrollbars.<br>
&lt;fantasai> oriol: To prevent this creating a change in behavior<br>
&lt;fantasai> oriol: we would need some kind of ???<br>
&lt;lea> I think "treat as 0" is more reasonable. width: 0; overflow: hidden would be problematic, but hopefully that'd be rare<br>
&lt;fantasai> oriol: So now I'm more aligned with choosing a specific number for NaN instead of an approach  similar to IVACT<br>
&lt;fantasai> oriol: I'm not sure infinity is the best, maybe zero or minus infinity<br>
&lt;fantasai> Rossen_: I think that during our discusison, and reason to revisit, the compounding effect of infinity can have very unpredictable results based on current user settings, viewport size, fonts available, etc.<br>
&lt;fantasai> Rossen_: that will make detectability of such errors difficult for authors, since spurious at best<br>
&lt;fantasai> Rossen_: Given we're out of time, don't want to force a resolution<br>
&lt;fantasai> Rossen_: but want to really go back and continue and see if we can agree on something more platform friendly<br>
&lt;fantasai> TabAtkins: in IRC, discussiong changing to zero<br>
&lt;fantasai> TabAtkins: I'm fine with that, Lea's fine with it<br>
&lt;chris> zero looks better to me<br>
&lt;fantasai> Rossen_: Ok, let's return to that next week<br>
</details>


-- 
GitHub Notification of comment by css-meeting-bot
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/7067#issuecomment-1104187025 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Wednesday, 20 April 2022 17:01:45 UTC