Closed Bug 1814668 Opened 3 years ago Closed 3 years ago

Toggling into and out of responsive design mode caches certain media query outcomes

Categories

(DevTools :: Responsive Design Mode, defect, P2)

Firefox 109
defect

Tracking

(firefox112 verified, firefox113 verified)

VERIFIED FIXED
112 Branch
Tracking Status
firefox112 --- verified
firefox113 --- verified

People

(Reporter: alex.nied, Assigned: emilio)

Details

Attachments

(3 files)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:109.0) Gecko/20100101 Firefox/109.0

Steps to reproduce:

For the purposes of this bug, the MUI site can be used:

  1. Navigate to the MUI Buttons Component Docs
  2. Hover an example button-- notice that its background color changes on hover. Inspect the same button, and note that by toggling the hover state in the dev tools you can see the background being changed.
  3. Toggle responsive design mode on; hover the same button for good measure
  4. Toggle response design mode off
  5. Try hovering the original button

Actual results:

The button no longer has background changes on hover; toggling the hover state in the dev tools show that a media query is being applied that gives the button a transparent background, overriding the previous background style.

Expected results:

The hover behavior for the button should have been the same as it was prior to opening and closing responsive design mode.

It is possible that this issues is related to Bug 1645208 — @media (hover: hover) breaks after going in and out of responsive design mode (Ctrl+Shift+M); however, given that that issue is 3 years old and was never able to be reproduced, I wasn't certain if it would be applicable anymore.

Also, for what it is worth, for me this issue can be resolved by refreshing the page; obviously, though, this is not ideal.

The Bugbug bot thinks this bug should belong to the 'DevTools::Responsive Design Mode' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Responsive Design Mode
Product: Firefox → DevTools

Could not reproduce initially, but it seems triggered after toggling on and off the Responsive Design Mode several times. For the record I had touch simulation enabled.

This actually starts breaking when toggling RDM fast enough, probably a race condition.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(nchevobbe)

Simpler STR:

  • Go to data:text/html,<meta charset=utf8><style>@media (hover:none) { body {background: tomato} }</style>hover none media
  • Trigger RDM, make sure touch simulation is enabled
  • Toggle RDM a few time until you get into a state where RDM is disabled but the background of the page is still red

Note that when you're in this state, resizing the browser will "fix" the rendering
It does only seems to be a rendering issue, as when in the "broken" state, matchMedia("(hover:none)") will say the query doesn't match, even if visually it does.

It looks like we have a few bugs reported about incorrect behavior when closing RDM (Bug 1662387, Bug 1533123, 1645208)

Flags: needinfo?(nchevobbe)

Emilio suggested that https://phabricator.services.mozilla.com/D168148 could help, but it doesn't seem to fix this issue.
Adding a needinfo as the issue might reveal a bug in gecko and emilio offered to have a look :)

Flags: needinfo?(emilio)
Assignee: nobody → emilio
Status: NEW → ASSIGNED

The MVM doesn't change the document viewer bounds nor the view manager
bounds (maybe it used to?). Right now when exiting RDM, depending on the
order of operations (if MVM reset is the last thing to happen) we end up
with a wrong viewport size, because nsDocShell::SetSize is
short-circuited here1.

Instead, force a resize reflow with the current dimensions which is what
the dynamic toolbar code also does, for example.

Depends on D169805

Flags: needinfo?(emilio)
Severity: -- → S3
Priority: -- → P2
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/0e640095619e Invalidate media queries when BrowsingContext::TouchEventsOverride changes. r=hiro
Pushed by ealvarez@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/713dcdc945d1 Fix viewport size invalidation on MVM changes. r=hiro
Pushed by nchevobbe@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/b5f84c4e8007 [devtools] Add test to check page state after closing RDM. r=jdescottes.
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
QA Whiteboard: [qa-112b-p2]

Reproducible on a 2023-02-13 Nightly build on macOS 12 using the STR from Comment 6.
Verified as fixed on Firefox 112.0(build ID: 20230403163424) and Nightly 113.0a1(build ID: 20230403215207) on macOS 12, Windows 10, Ubuntu 22.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-112b-p2]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: