Bug 156687

Summary: px, em, rem should behave the same in media queries when page zoom is applied
Product: WebKit Reporter: Chris Rebert <webkit>
Component: Layout and RenderingAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: danburzo, kaelig, rik, simon.fraser, webkit-bug-importer
Priority: P2 Keywords: HasReduction, InRadar
Version: WebKit Nightly Build   
Hardware: Mac   
OS: OS X 10.11   
URL: http://codepen.io/cvrebert/pen/KzRXJd
See Also: https://bugs.webkit.org/show_bug.cgi?id=156684
Bug Depends on:    
Bug Blocks: 159753    

Description Chris Rebert 2016-04-18 00:47:46 PDT
Steps to reproduce:
1. Open http://codepen.io/cvrebert/pen/KzRXJd in Safari/WebKit.
2. Click the "Change View" button.
3. A menu appears.
4. Under "Editor Layout", click the first button on the left.
5. Click the "Change View" button again to dismiss the menu.
6. Zoom in on the page in Safari/WebKit (View->Zoom In, ⌘+)
7. Resize the output pane by dragging the separator on the left edge of the output pane.

Actual results:
As you resize the output pane, the red, green, and blue bars become translucent or opaque at different widths.

Expected results:
As you resize the output pane, the red, green, and blue bars should
all become translucent or opaque together at the same time when passing a particular width boundary point.
This is the behavior exhibited by Chrome, Firefox, and MS Edge when their page zoom features are activated on said testcase webpage.

Though non-pinch page zooming is not currently standardized AFAICT, this deviation from other browsers hurts interoperability
and offers an unfortunate reason to avoid px-based media queries. See also http://zellwk.com/blog/media-query-units/#2-user-zooms-in
Note that the 3 media queries all compute to the same width value under default, non-zoomed circumstances.
Comment 1 Radar WebKit Bug Importer 2016-04-18 08:38:49 PDT
<rdar://problem/25778630>
Comment 2 Dan Burzo 2019-09-26 02:29:15 PDT
This is still a problem in Safari Technology Preview 13.1 on macOS, but seems to have been fixed on iOS/ipadOS 13. 

Safari on macOS continues to factor in the zoom ratio into em and rem units for Media Queries.
Comment 3 Dan Burzo 2019-09-26 02:48:32 PDT
(In reply to Dan Burzo from comment #2)
> This is still a problem in Safari Technology Preview 13.1 on macOS, but
> seems to have been fixed on iOS/ipadOS 13. 
> 
> Safari on macOS continues to factor in the zoom ratio into em and rem units
> for Media Queries.

However nonsensical these types of media queries might be, the problem also applies to viewport-relative units such as `vw`.