Contact emails
dgr...@chromium.org, p...@chromium.org
Explainer
https://github.com/w3c/csswg-drafts/blob/main/css-env-1/explainers/meta-text-scale.md
Specification
https://github.com/w3c/csswg-drafts/pull/12469/files (in progress)
Summary
Makes the root element's default font size scale in proportion to both the operating system's and browser's text scale setting. This allows pages that follow best practices around font-relative units (i.e. use rem and em for font sizes and page elements that should change with the user's text size preferences) to respect the user's OS-level text scale setting. This also causes the browser to disable existing browser-based mechanisms (i.e. full-page zoom on windows) and heuristics (i.e. text autosizing on mobile). Now web developers can signal to the browser that the page is constructed in a way (i.e. with rem and em) that will scale well across various user-selected font size preferences. Similar to env(preferred-text-scale), which provides authors with a way to access the text scale; this API extends that by enabling scaling via the root element's default font size and opting-out of automatic text scaling.
Blink component
Motivation
Authors currently don't have an easy way to respect the OS-level text scale setting on all devices. It is practically impossible to detect and respect this on desktop. On mobile, there is env(preferred-text-scale), but authors would need to use it in calc() functions to set the root font-size and some media queries. They would need a lot of guidance to ensure it gets used correctly and there would be little variation in how they would use it. Therefore, it would be much easier for authors if they could continue to use font-relative units as they do now and the UA initial font-size was redefined to incorporate the OS-level text scale setting. However, we can’t simply change the UA initial font size OS-level without pages opting in due to compat issues.
Initial public proposal
https://github.com/w3c/csswg-drafts/issues/12380
TAG review
None yet
Risks
Interoperability and Compatibility
Compat – no issues as it's a new feature.
Interop – none really – even if other browsers don't implement it's a progressive enhancement
Gecko: No signal
WebKit: No signal
Web developers: Positive (https://github.com/w3c/csswg-drafts/issues/12380) Positive emoji votes on the initial proposal
Other signals:
WebView application risks
Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?
There are WebView-specific behaviors, but we don't anticipate higher risk for WebView.
In addition to disabling existing browser-based mechanisms for obeying OS-level text scale preferences, on WebView we anticipate this meta tag will also
cause setTextZoom (developer.android.com) to have the same effect as the OS slider (i.e., stop changing every font size on the page and instead change the page's initial font size, letting the setTextZoom argument percolate through the page as the author intended with their rem usage)
Ignore TEXT_AUTOSIZING (developer.android.com) LayoutMode (if it still exists; we intend to deprecate this mode in parallel with this launch)
Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, ChromeOS, Android, and Android WebView)?
Yes
Is this feature fully tested by web-platform-tests?
Not yet
Requires code in //chrome?
False
Estimated milestones
No milestones specified
Link to entry on the Chrome Platform Status
https://chromestatus.com/feature/5112244702674944?gate=5142954054385664
This intent message was generated by Chrome Platform Status.