What opening DevTools changes#
| Change | What the page sees | How to keep it without hiding the bug |
|---|---|---|
| Focus moves to DevTools | blur on the window, document.hasFocus() becomes false; focusout on the active element | Turn on Emulate a focused page in the Rendering panel |
| The viewport shrinks (docked to the side or bottom) | A resize event and a smaller innerWidth or innerHeight, which can cross a breakpoint | Undock DevTools into a separate window |
| Disable cache is on | Every resource refetched from the network | Turn it off and compare |
| Network or CPU throttling left on from earlier | Different timing | Check the throttling menus |
| A paused breakpoint, or a slow console | Timers and responses arrive while the script is paused | Use logpoints instead of breakpoints |
| Logging an object to the console | The console keeps a reference, so the object is not garbage collected | Log copies, or nothing, while checking memory |
Chrome DevTools: Emulate a focused page
Bugs that depend on focus#
Focus is the most common reason. Code that reacts to blur, focusout or visibilitychange runs the moment you click into DevTools:
- A dropdown or date picker closes on blur, so you cannot inspect its open state.
- A form validates on blur, so a field shows an error that real use would not show yet.
- An app pauses polling when the window loses focus, so a race between polling and an action disappears.
Emulate a focused page keeps the page treating itself as focused while you work in DevTools. For an element that disappears on blur, you can also pause on the moment it opens: in Sources, use the Event Listener Breakpoints for the event that opens it, or press F8 to pause script execution while the element is visible.
Bugs that depend on timing#
A breakpoint stops the page's JavaScript, but the network keeps going and timers come due. When you resume, everything that was waiting runs in a different order from real use. A race that depended on a response arriving before a timer can vanish under a breakpoint.
Use logpoints, which log without pausing, or console.log with timestamps. To make the race repeatable, control the order deliberately: hold one response.
Write down what made it disappear#
When you find which change hid the bug, it belongs in the report: "Reproduces with DevTools undocked; disappears when DevTools is docked at 1280 px wide, because the layout switches to tablet" saves the maintainer the same hour. Then reproduce it without DevTools in a script, where nothing observes the page: codegen or a trace.
Worked example: an autocomplete list that would not stay open#
This example is fictional. A tester reports that the address autocomplete's suggestions overlap the Continue button. Every time the developer opens DevTools to inspect the list, the list closes.
The list closed on the input's blur, which fired when focus moved into DevTools. With Emulate a focused page on, the list stayed open, and the developer saw the list's container set to z-index: 1 inside a parent with its own stacking context. The bug had been there all along. The page's blur handling only hid it from the inspector.
Questions#
Why does the bug also disappear in a recording tool?
Screen recorders and remote debugging can change focus and timing in the same ways. Note which tool was running when the bug did or did not appear.
Does Firefox have the same problem?
Yes, opening its developer tools also moves focus and can shrink the viewport. Undocking the tools helps in the same way.
What if the bug only appears with DevTools open?
Then look at the same list in reverse: Disable cache forcing fresh responses, throttling left on, a breakpoint changing timing, or the smaller viewport. The cause is real either way, but it may not be one users meet.
Return to reproducing what someone else saw for the other layers a replay needs.