question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Lighthouse resets emulation incorrectly after DevTools run

See original GitHub issue

FAQ

URL

https://1uqxj0.csb.app/

What happened?

Lighthouse seems to reset the screen width emulation on mobile devices (from window.screen.width) after a report is generated. This can affect subsequent reports.

To reproduce:

  1. Open the URL on Chrome, using responsive mode change your device to any device with < 600px width (e.g. iPhone SE).
  2. Refresh the page – you should see the page display the text “portrait”.
  3. Run a Lighthouse report. While the test is running, the page should also display “portrait”.
  4. Once page refreshes after the report is generated, the page will display “landscape”. Refreshing the page will still show “landscape”.
  5. Any subsequent runs of Lighthouse will also display “landscape” on the screen.

You can reset this by going out of responsive mode and going back in.

What did you expect?

I expected Lighthouse to maintain the window.screen emulation after the first report.

What have you tried?

Running without Lighthouse works fine – you can jump in and out of responsive mode without any hitches. Firefox and Safari also work fine.

How were you running Lighthouse?

Chrome DevTools

Lighthouse Version

9.5.0

Chrome Version

102.0.5005.61

Node Version

No response

OS

MacOS

Relevant log output

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
adamrainecommented, Jun 21, 2022

The workaround for DevTools will land in M105. This still affects things like user flows so I’m gonna leave the issue open.

Maybe there is a workaround but hopefully there is a proper CDP solution.

0reactions
sidvircommented, Jun 20, 2022

Thanks so much for the quick response! When can I expect the lighthouse fix/workaround to hit Chrome?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Lighthouse Summary shows wrong device emulation ... - GitHub
Hi, Tried running lighthouse from puppeteer script with device emulation as "puppeteer.devices['iPad landscape']". Also visually i can see that ...
Read more >
device emulation is not applied during mobile lighthouse audit ...
Issue 991906: Devtools: device emulation is not applied during mobile lighthouse audit. Reported by schedule cjamcl@google.com ...
Read more >
You're probably using Lighthouse wrong | Vue Storefront
Most people use Chrome Devtools to run their Lighthouse audits, and this is probably the least reliable way of doing it.
Read more >
Node Lighthouse not returning similar results for accessibility
As you can see in the code, I am running a headless node version so there is no browser or performance tab. I...
Read more >
What's New In DevTools (Chrome 94)
Use the following options to discuss the new features and changes in the post, or anything else related to DevTools.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found