browser-compat-data icon indicating copy to clipboard operation
browser-compat-data copied to clipboard

Add the new `preferred-text-scale` env variable

Open captainbrosset opened this issue 7 months ago • 5 comments

What type of issue is this?

Missing compatibility data

What information was incorrect, unhelpful, or incomplete?

See https://chromestatus.com/feature/5328467685801984 And https://drafts.csswg.org/css-env-1/#text-zoom

The preferred-text-scale CSS environment variable exposes a user's preferred font scale to CSS. This new CSS env variable is shipping in Chromium 138.

What browsers does this problem apply to, if applicable?

Chromium (Chrome, Edge 79+, Opera, Samsung Internet)

What did you expect to see?

New compat data in https://github.com/mdn/browser-compat-data/blob/main/css/types/env.json

Did you test this? If so, how?

N/A

Can you link to any release notes, bugs, pull requests, or MDN pages related to this?

No response

Do you have anything more you want to share?

No response

MDN URL

No response

MDN metadata

No response

captainbrosset avatar May 28 '25 09:05 captainbrosset

According to https://chromestatus.com/feature/5328467685801984, this only ships in Chrome Android, but neither the implementing commit nor the shipping commit mention this restriction, so it probably ships in Desktop as well.

@captainbrosset Can you confirm?

caugner avatar May 30 '25 09:05 caugner

@davidsgrogan can you help with the above question please?

captainbrosset avatar Jun 02 '25 09:06 captainbrosset

env(preferred-text-scale) will return the OS-level font setting on Android starting in Chrome 138. It will always return 1 on Desktop though. We have a bit more work to do to support non-1 values on Desktop.

LMK if you want more clarification.

davidsgrogan avatar Jun 02 '25 16:06 davidsgrogan

Thanks for clarifying.

So what we need to do here is to mark chrome as partial implementation with notes (Always returns 1. See [bug 419469463](https://issues.chromium.org/issues/419469463).), and chrome_android as full support.

It looks like the variable is not yet supported in media queries (https://issues.chromium.org/issues/419596998), which warrants at least a note, or could justify marking Android implementation as partial as well.

caugner avatar Jun 04 '25 09:06 caugner

It looks like the variable is not yet supported in media queries (https://issues.chromium.org/issues/419596998)

That's correct, but note that no environment variables are available in media queries in either Chrome or Firefox at all. (Not sure about Safari.)

davidsgrogan avatar Jun 04 '25 15:06 davidsgrogan