Skip to content

Closing Edge DevTools causes page to scroll to top due to focus reset #362

@yinhx3

Description

@yinhx3

Description:
When closing DevTools in Microsoft Edge, the page unexpectedly scrolls to the top. This behavior is caused by the browser resetting focus to the first focusable element in the document, which triggers a scroll jump. This issue does not occur in Chrome under the same conditions.

Steps to Reproduce:

  1. Open a scrollable webpage, e.g. Google Search.
  2. Scroll down to the middle or bottom of the page.
  3. Press F12 to open DevTools.
  4. Do not click on the page — leave focus on DevTools.
  5. Press F12 or click the X button to close DevTools.
  6. The page jumps to the top.

Alternative Behavior:
If the user clicks anywhere on the page to return focus to the document before pressing F12 to close DevTools, the scroll position is preserved and no jump occurs.

Expected Behavior:
The page should retain its scroll position after DevTools is closed, regardless of focus state.

Actual Behavior:
The page scrolls to the top due to focus being reset to the first element in the document.

Why This Matters:
This disrupts user experience, especially on long-scroll pages like search results, documentation, or dashboards. It also affects developers who are debugging scroll-related behavior.

Environment:

  • Browser: Microsoft Edge
  • OS: Windows
  • Edge Version: 140

Notes:

  • Chrome does not exhibit this behavior, even when DevTools is closed without refocusing the page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions