Hi Peter, Yeah, we call out that WebView situation in the explainer: https://github.com/w3c/csswg-drafts/blob/main/css-env-1/explainers/env-preferred-text-scale.md#note-android-webview We recommend WebView authors whose pages use env(preferred-text-scale) to call setTextZoom(100) <https://developer.android.com/reference/android/webkit/WebSettings#setTextZoom(int)> to avoid app breakage.
It was actually one of our 3p partners who brought this to our attention. David On Tue, May 27, 2025 at 2:48 AM Peter Birk Pakkenberg <pb...@chromium.org> wrote: > Hi, > > It is not entirely clear if this will also be enabled for WebView as part > of the Android enablement. > WebView has an API to explicitly set the text zoom > <https://developer.android.com/reference/android/webkit/WebSettings#setTextZoom(int)>, > which is applied to the FrameWidget here > <https://source.chromium.org/chromium/chromium/src/+/main:android_webview/renderer/aw_render_frame_ext.cc;l=278;drc=ce105292810e6be50e97686ae76b32fb6c3579c8;bpv=1;bpt=1> > (and > to the WebPreferences here if the layout algorithm is text_autosizing > <https://source.chromium.org/chromium/chromium/src/+/main:android_webview/browser/aw_settings.cc;l=589;drc=ce105292810e6be50e97686ae76b32fb6c3579c8;bpv=1;bpt=1?q=getTextSizePercentLocked>), > so it sounds like this change would be useful for WebViews as well, but at > the same time could cause app breakage if the app developer is using this > API and their page rendering suddenly changes. > > > Sincerely, > [image: Google Logo] > Peter Birk Pakkenberg > Software Engineer > pb...@chromium.org > > > On Fri, 23 May 2025 at 23:49, 'Philip Rogers' via blink-dev < > blink-dev@chromium.org> wrote: > >> Thanks Daniel! Responses inline. >> >> On Thursday, May 22, 2025 at 9:49:57 PM UTC-7 Daniel Herr wrote: >> >> I've skimmed through these docs, and personally it seems like an >> unnecessary feature. >> >> The explainer says a considered alternative is >> "font-size: medium would always be affected by the OS-level font scale." >> with cons >> "Sites are NOT built correctly and things that used to just look small >> would now be clipped >> You can simulate the effect of this alternative in Chrome by setting the >> UA-level font at chrome://settings/fonts. Set "font-size" to the maximum. >> old.reddit.com, gmail, etc, all break. Sites today ineffectively mix px >> and em because there is no safeguard against doing so — few authors change >> the UA-level font-size at chrome://settings/fonts." >> >> So why would introducing another way to adapt to the user's >> preferred font size fix the root problem? Developers will continue to >> create bad code with pem instead of em which break when the user sets a >> higher font size. >> >> >> On its own, env(preferred-text-scale) does not prevent the issues we saw >> with em/rem. I think the prevalence of non-default text scale settings on >> mobile (over a third of mobile users) and more focus on accessibility mean >> it will receive more attention than in the past. This is amenable to >> automated testing with a command line flag, and we are hoping to add a >> devtools option (https://crbug.com/419595584) next to similar options >> for dark mode, high contrast, etc. >> >> One small note: this proposal is only for env(preferred-text-scale) and >> not pem. >> >> >> You mention that "Currently, it is not practical for a page to detect if >> the user has changed their preferred font size via the Operating System's >> preferences." That's not always true, for example on Chrome OS the system >> wide font size setting (also used for Android apps) has been Chrome's web >> font size settings. >> >> But my biggest concern is backwards compatibility. Does this work mean >> that em/rem will no longer scale with font size settings in the future? >> >> >> This proposal enables developers to opt-in to having em/rem reflect the >> Android OS font setting in a backwards-compatible way. Our recommended >> best-practice is: >> :root { >> font-size: calc(100% * env(preferred-text-scale, 1)); >> } >> With this, authors can use em/rem as before, but these will now include >> the Android OS font setting. >> >> >> >> On Thu, May 22, 2025 at 10:07 PM Domenic Denicola <dom...@chromium.org> >> wrote: >> >> >> >> On Fri, May 23, 2025 at 9:00 AM Chromestatus < >> ad...@cr-status.appspotmail.com> wrote: >> >> Contact emails dgr...@chromium.org, p...@chromium.org >> >> Explainer https://davidsgrogan.github.io/env-explainer.html >> >> Specification https://drafts.csswg.org/css-env-1/#text-zoom >> >> Summary >> >> Exposes a user's preferred font scale to CSS. Currently, it is not >> practical for a page to detect if the user has changed their preferred font >> size via the Operating System's preferences. This CSS environment variable >> will reflect the scale chosen by the user. >> >> >> Blink component Blink>Accessibility >> <https://issues.chromium.org/issues?q=customfield1222907:%22Blink%3EAccessibility%22> >> >> TAG review https://github.com/w3ctag/design-reviews/issues/1101 >> >> TAG review status Pending >> >> Risks >> >> >> Interoperability and Compatibility >> >> None >> >> >> *Gecko*: No signal ( >> https://github.com/mozilla/standards-positions/issues/1229) >> >> *WebKit*: No signal ( >> https://github.com/WebKit/standards-positions/issues/499) >> >> *Web developers*: Positive ( >> https://github.com/w3c/csswg-drafts/issues/10674) This proposal started >> with a request from a BBC developer >> >> *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? >> >> None >> >> >> Debuggability >> >> This can be debugged using existing devtools support by connecting to a >> device. We have a plan for making this easier at >> https://crbug.com/419595584. >> >> >> Will this feature be supported on all six Blink platforms (Windows, Mac, >> Linux, ChromeOS, Android, and Android WebView)? No >> >> Initial support will be limited to Android, which has limited practical >> ability to respect the OS font scale today. On Windows, we scale the entire >> browser in response to the OS setting, and some followup work is needed to >> support this while not double-zooming. >> >> >> I'd like to learn more about this from a compat and interop perspective. >> From skimming the explainer, this seems like a complicated problem space. >> >> If we never ship support on desktop, and authors start using this >> feature, what will the user experience be? >> >> If we don't ship support on desktop for 10 milestones, but then suddenly >> do, what will the user experience be? >> >> You mentioned Windows, but what about macOS, Linux, ChromeOS, and Android >> WebView? >> >> >> >> >> Is this feature fully tested by web-platform-tests >> <https://chromium.googlesource.com/chromium/src/+/main/docs/testing/web_platform_tests.md> >> ? Yes >> >> This is tested with internal WPT tests due to lack of support for OS font >> scale setting in tests. >> https://github.com/web-platform-tests/wpt/issues/12725 >> >> >> Flag name on about://flags None >> >> Finch feature name CSSPreferredTextScale >> >> Rollout plan Will ship enabled for all users >> >> Requires code in //chrome? False >> >> Tracking bug https://crbug.com/397737223 >> >> Measurement UseCounter: >> https://chromestatus.com/metrics/feature/popularity#CSSEnvironmentVariable_PreferredTextScale >> >> Estimated milestones Shipping on Android 138 >> >> Anticipated spec changes >> >> Open questions about a feature may be a source of future web compat or >> interop issues. Please list open issues (e.g. links to known github issues >> in the project for the feature specification) whose resolution may >> introduce web compat/interop risk (e.g., changing to naming or structure of >> the API in a non-backward-compatible way). >> https://github.com/w3c/csswg-drafts/issues/10674 >> >> Link to entry on the Chrome Platform Status >> https://chromestatus.com/feature/5328467685801984?gate=6195643460354048 >> >> Links to previous Intent discussions Intent to Prototype: >> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOZbSt1dSWUwuFD%2Bu%3DwGXf-ubdgh8K%3D0oj13%3DkrvADSOM41xtw%40mail.gmail.com >> >> >> This intent message was generated by Chrome Platform Status >> <https://chromestatus.com>. >> >> -- >> You received this message because you are subscribed to the Google Groups >> "blink-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to blink-dev+...@chromium.org. >> To view this discussion visit >> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/682fba7d.170a0220.2aa17e.152d.GAE%40google.com >> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/682fba7d.170a0220.2aa17e.152d.GAE%40google.com?utm_medium=email&utm_source=footer> >> . >> >> -- >> You received this message because you are subscribed to the Google Groups >> "blink-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to blink-dev+...@chromium.org. >> >> To view this discussion visit >> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAM0wra9kLUA-FJ_et-2%3DbVCVJ6miD6zNw1LgJYNTAh8fiE_8WA%40mail.gmail.com >> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAM0wra9kLUA-FJ_et-2%3DbVCVJ6miD6zNw1LgJYNTAh8fiE_8WA%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> -- >> You received this message because you are subscribed to the Google Groups >> "blink-dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to blink-dev+unsubscr...@chromium.org. >> To view this discussion visit >> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/bf55edc4-c0dc-4dd3-9899-d612bfdc9386n%40chromium.org >> <https://groups.google.com/a/chromium.org/d/msgid/blink-dev/bf55edc4-c0dc-4dd3-9899-d612bfdc9386n%40chromium.org?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "blink-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+unsubscr...@chromium.org. To view this discussion visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAOZbSt1hvvwrQ4T2r%3DAXmz2YmEyubGBrbBeqzSYS%3DXOeMgCT1g%40mail.gmail.com.