Closed Bug 1442212 Opened 7 years ago Closed 7 years ago

Media Query in rem unit doesn't trigger on resize when html has a font-size defined

Categories

(Core :: CSS Parsing and Computation, defect)

58 Branch
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1396057
Tracking Status
firefox58 --- affected
firefox59 --- ?
firefox60 --- unaffected

People

(Reporter: remi+bugzilla, Unassigned)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.186 Safari/537.36 Steps to reproduce: 1. Adjust your browser window's width above 961px. 2. Go to https://hteumeuleu.fr/wp-content/uploads/2018/03/fx-media-queries-rem.html (or attached file). 3. Resize the browser window's width below 960px. Actual results: The background defined in the media query (`max-width: 60rem`) only changes below 600px. If you reload the page at any point below 960px, the background color effectively changes. Expected results: The background color should have been changed below 960px when resizing the window, and not below 600px. There should be no difference between resizing and reloading the page. Per specification (https://www.w3.org/TR/css3-mediaqueries/#units): > Relative units in media queries are based on the initial value, which means that units are never based on results of declarations. This means that with a default font size of 16px, a media queries of 60rem equals 960px. So this is the correct value, it's just not applied. This all only happens when there is a different `font-size`set on the `html` element than the browser's default font size value.
Here is another testpen: a paragraph should appear at <800px, however the breakpoint is triggered at 500px. There is a reset on html to have 10px as base font size, so 50rem * 10px = 500px. https://codepen.io/nico3333fr/full/xYMJrg/
I reproduce in 58 but this works as expected in my Nightly (v60, 20180227220155). Let's see if somebody from the CSS team knows more.
Component: Untriaged → CSS Parsing and Computation
Product: Firefox → Core
I bisected, looks like it's been fixed by https://github.com/servo/servo/pull/19194
Ah yes, it's bug 1396057.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: