Re: [csswg-drafts] [css-fonts] consider not making font-min-size and font-max-size affect font-size computed value (#3739)

The CSS Working Group just discussed `font-min/max-size and computed value`, and agreed to the following:

* `RESOLVED: Remove min-font-size and max-font-size from Fonts 4, replace with an example of using clamp() to handle safe responsive typography.`

<details><summary>The full IRC log of that discussion</summary>
&lt;TabAtkins> Topic: font-min/max-size and computed value<br>
&lt;fantasai> I've updated https://wiki.csswg.org/spec/publish with the blanket publication resolution<br>
&lt;fantasai> fwiw<br>
&lt;astearns> github: https://github.com/w3c/csswg-drafts/issues/3739<br>
&lt;TabAtkins> emilio: Browsers have minimum font-size settings for a11y<br>
&lt;TabAtkins> emilio: And they work differently in WK-based vs Firefox<br>
&lt;TabAtkins> emilio: WK-based browsers, it affects the font-relative units.<br>
&lt;TabAtkins> emilio: In Firefox they do not.<br>
&lt;TabAtkins> emilio: So I was considering implementing min-font-size, and that affects the computed value of font-size, I would assume<br>
&lt;TabAtkins> emilio: So first, the a11y setting in Blink can break websites<br>
&lt;TabAtkins> emilio: I'd also like min-font-size to work the same as the a11y setting.<br>
&lt;TabAtkins> fantasai: Reason it affects computed and not just used font size is that if you were using ems correctly (for the purpose of making something relative to text size), then everything should scale and match the size of text.<br>
&lt;TabAtkins> AmeliaBR: How much would things break if we declared a different computed value for inheritance vs font-relative units?<br>
&lt;TabAtkins> dbaron: Which is what I thought Gecko did, and maybe what it did pre-servo<br>
&lt;TabAtkins> fantasai: That would be fine and would honor the constraint we want<br>
&lt;TabAtkins> emilio: Would it?<br>
&lt;TabAtkins> [Amelia re-explains their proposal]<br>
&lt;fantasai> TabAtkins: So on any given element, 1.2em would still be 120% size of the text<br>
&lt;TabAtkins> emilio: That would still break websites if we used this to ipmlement the a11y setting<br>
&lt;fantasai> dbaron: ...<br>
&lt;TabAtkins> dbaron: I think this is mostly problematic because of people misusing rem to get a custom-sized unit<br>
&lt;fantasai> s/.../people use the root font size to create a unit that's not really related to the font size, and that breaks if you apply font size minimums to it/<br>
&lt;TabAtkins> jensimmons: And they want nice math, yeah<br>
&lt;dbaron> s/mostly/also significantly/<br>
&lt;TabAtkins> myles_: So it sounds like users are getting min-font-size via the UI settings; could you just keep that separate from min-font-size property?<br>
&lt;TabAtkins> emilio: Yeah, we could. But it would still mean the minimum font size setting is magical; you couldn't override that in a user stylesheet.<br>
&lt;TabAtkins> dbaron: Also one of the underlying principles of CSS is that it explians how author and user expectations work with each other. Settings/prefs are usually explained as part of the user stylesheet.<br>
&lt;AmeliaBR> q+ to talk about author use of min/max-font-size<br>
&lt;TabAtkins> myles_: Right. There just might be a distinction between an author saying they want to scale up a font size, and the user saying they can't see text smaller than a certain value.<br>
&lt;TabAtkins> dbaron: Also, minimum font sizes don't seem to work well in practice anyway, many pages break. So maybe this isn't the most useful anyway.<br>
&lt;TabAtkins> fantasai: So if authors do understand the unit and use things correctly, things should still scale correctly.<br>
&lt;TabAtkins> jensimmons: So to clarify, there's a min/max-font-size, and maybe you set font-size with a calc(vw) or whatever.<br>
&lt;TabAtkins> jensimmons: So if you hit a min or a max, and we cap it when you hit the limit, should that propagate to the 'em' unit, that's the question, right?<br>
&lt;chris> yes, exactly<br>
&lt;TabAtkins> [yes]<br>
&lt;TabAtkins> jensimmons: It doesn't even make sense to me that it wouldn't transfer over.<br>
&lt;florian> +1 to jensimmons<br>
&lt;astearns> ack AmeliaBR<br>
&lt;Zakim> AmeliaBR, you wanted to talk about author use of min/max-font-size<br>
&lt;fantasai> /So/CSS provides a variety of units to allow authors to express the why of their sizes through relative measurements, against the font or the screen or the container or the pixels, etc. Authors who understand these units will use font-relative units when they want things to scale with the font, so/<br>
&lt;TabAtkins> AmeliaBR: So while CSS gives people the tools to use things properly, we have to recognize that some people won't use it correctly.<br>
&lt;fantasai> jensimmons gives an example of e.g. gmail which doesn't handle the scaling of text correctly, so zooming in creates a suboptimal layout -- but this is a case of the author not choosing to use the correct units ; breaking the connection between ems and font-size would make it impossible to fix<br>
&lt;TabAtkins> dbaron: I think I agree that making 'em' honor min/max is the only thing that makes sense. It's not clear to me which to go with inheritance, as it depends on use-case<br>
&lt;TabAtkins> fantasai: There was a comment from Fred Lang, where if min/max clamped the value before inheriting, you'd have a size in the multi-step process that gets messed up and messes up all subsequent sizes.<br>
&lt;leaverou> Agreed with dbaron. Authors use ems assuming they correspond to actual used font size. If that assumption breaks, a lot of UIs would too.<br>
&lt;dbaron> s/Lang/Wang/<br>
&lt;fantasai> fantasai: So I agree with Amelia that the computed / inherited font-size should not be affected by the min/max, but that the min/max should factor into not just the used font size but also the resolution of font-relative units<br>
&lt;fantasai> fantasai: We would be doing authors a disservice if we did not ensure that the font-size and 1em matched.<br>
&lt;astearns> ack dbaron<br>
&lt;chris> I agree with that proposed solution<br>
&lt;chris> ... otherwise things end up double-applied, growing too much<br>
&lt;TabAtkins> dbaron: I think this is a reasonable conclusion, I think it doesn't work well for Jen's use-case, but I think what does work well for that is using min()/max() inside of font-size.<br>
&lt;chris> ... clamping should happen as late as possible<br>
&lt;TabAtkins> dbaron: Because you want clamping to happen at a particular point, not to be inherited down further into the tree. So you'd use `font-size: clamp(10px, ..., 36px);`<br>
&lt;TabAtkins> AmeliaBR: Right, and that would be bad for min-font-size, as then a `&lt;small>` child would also get clamped and not get smaller. While clamp() works properly<br>
&lt;chris> q?<br>
&lt;chris> q+<br>
&lt;heycam> q+<br>
&lt;astearns> ack chris<br>
&lt;TabAtkins> chris: THis has been interesting. Not sure I could reproduce this aftera few days. I want some examples in the spec of what you should use each with.<br>
&lt;AmeliaBR> +1 to examples!<br>
&lt;heycam> q-<br>
&lt;fremy> (side note for people interested in this and would love examples, Jason Pamental talk at cssconf this year is a great resource)<br>
&lt;iank_> q+<br>
&lt;TabAtkins> TabAtkins: I think we're leanign toward the properties being designed purely for the a11y/settings use-case, and if you want to just clamp a value in a range, you should always use the math functions.<br>
&lt;astearns> ack iank_<br>
&lt;TabAtkins> iank_: Currently the way we do this in Blink for a11y isn't via a property because the font-size clamping we do applies on a per-region basis.<br>
&lt;TabAtkins> myles: Ours is also complicated, probably in a different way.<br>
&lt;TabAtkins> myles: It seems like dbaron was saying the function of CSS was to explain browser features. It sounds like this feature shouldn't be explained in CSS, and it should remain magic.<br>
&lt;TabAtkins> emilio: It sounds like Ian is talking about the text auto-sizing actually?<br>
&lt;TabAtkins> myles: Ah, but I wasn't in mine.<br>
&lt;TabAtkins> myles: We have a lot of systems that interact to produce a text size.<br>
&lt;TabAtkins> myles: I've spent a long time trying to increase readability, and...<br>
&lt;TabAtkins> myles: The issue is "I want to use this CSS feature to do a11y, but things break", then we just shouldn't use that feature.<br>
&lt;TabAtkins> florian: So what are we using these for?<br>
&lt;fantasai> myles: These were added before my time...<br>
&lt;TabAtkins> myles: These predate me, there was just a note in the spec and I started implementing<br>
&lt;TabAtkins> TabAtkins: These predate the math functions; they were meant to implement the "keep vw-based font sizes from getting too big/small"<br>
&lt;TabAtkins> TabAtkins: So we can just drop the properties, then<br>
&lt;TabAtkins> chris: I was looking at history; this looks like something that was dropped from Fonts 3, and Myles dropped it into Fonts 4 two years ago.<br>
&lt;tantek> agreed with TabAtkins<br>
&lt;tantek> proposal: drop the properties because not implemented anywhere<br>
&lt;TabAtkins> astearns: So these aren't implemented in a user-facing way anywhere, and we're not convinced they're good for any use-case...<br>
&lt;tantek> jensimmons: responsive typography is what the use-case is called, you can search for it<br>
&lt;fantasai> https://lists.w3.org/Archives/Public/www-style/2014Jun/0187.html<br>
&lt;AmeliaBR> `font-size: clamp(12px, 10vmin, 24px)` vs `font-size: 10vmin; min-font-size: 12px; max-font-size: 24px;`<br>
&lt;TabAtkins> astearns: So looks like we have consensus to remove these properties, until we have a use-case that min()/max()/clamp() don't serve.<br>
&lt;TabAtkins> AmeliaBR: And replace the section with an example of how to use clamp()l.<br>
&lt;tantek> aside: how do we do copy-fitting<br>
&lt;TabAtkins> RESOLVED: Remove min-font-size and max-font-size from Fonts 4, replace with an example of using clamp() to handle safe responsive typography.<br>
&lt;tantek> q?<br>
&lt;chris> q?<br>
&lt;TabAtkins> heycam: The effect of these properties on the computed value of font-size... still worth resolving on how these browser settings affect things?<br>
&lt;fantasai> ChrisL: Example of broken is page with &lt;html style="font-size: 1px">. Answer is, don't do that.<br>
&lt;fantasai> TabAtkins: The way it inherits separately is a problem for designing a font hierarchy relative to a base size, tho<br>
&lt;fantasai> AmeliaBR: Should we give advice to browsers on whether font-relative units should be affected by browser settings?<br>
&lt;fantasai> myles: Arguments on both sides<br>
&lt;fantasai> myles: If we don't expose to authro, they don't know what happened to their page<br>
&lt;fantasai> myles: I don't think it should be specced<br>
&lt;TabAtkins> TabAtkins: Note tho that h6 defaults to smaller than standard font size. If min-font-size is set to standard-font-size (both 16px, say), and you defined your hX hierarchy by starting from h6 size and then calc()ing up the higher values, the Chrome behavior would mess things up; starting from h1 and calc()ing down would be fine. So it's not *all* pathological cases.<br>
&lt;astearns> ack dbaron<br>
&lt;TabAtkins> dbaron: To respond to myles there's another tradeoffs around a11y<br>
&lt;TabAtkins> dbaron: Some users that need a11y are concerned about privacy, and are willing to have the feature not work as well to keep secret that they're using it.<br>
&lt;TabAtkins> TabAtkins: For this feature, no matter how you do it it'll be page-exposed tho<br>
&lt;TabAtkins> dbaron: Also, the browser minimum isn't *really* a minimum.<br>
&lt;TabAtkins> dbaron: If you specify a min of 10px to font-size:1px, you get 10px font. But applied to font-size:0px, you get 0px. That's very important. So it's not a strict "minimum" anyway.<br>
&lt;fantasai> myles: Example is layout with inline-blocks, set font-size: 0px so that the gap below the baseline is zeo.<br>
&lt;TabAtkins> TabAtkins: Myles, wanna capture that 0px point in the spec? If everyone agrees something is needed for webcompat, it should be captured<br>
&lt;TabAtkins> myles: In a note, sure<br>
</details>


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

Received on Tuesday, 4 June 2019 18:29:21 UTC