Lighthouse resets emulation incorrectly after DevTools run
See original GitHub issueFAQ
- Yes, my issue is not about variability or throttling.
- Yes, my issue is not about a specific accessibility audit (file with axe-core instead).
URL
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:
- Open the URL on Chrome, using responsive mode change your device to any device with < 600px width (e.g. iPhone SE).
- Refresh the page – you should see the page display the text “portrait”.
- Run a Lighthouse report. While the test is running, the page should also display “portrait”.
- Once page refreshes after the report is generated, the page will display “landscape”. Refreshing the page will still show “landscape”.
- 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:
- Created a year ago
- Comments:7 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.
Thanks so much for the quick response! When can I expect the lighthouse fix/workaround to hit Chrome?