[Mac] Fix undocked DevTools focus returning to wrong window for PWAs [chromium/src : main]

1 view
Skip to first unread message

Lichen Liu (Gerrit)

unread,
Jan 19, 2026, 1:41:05 AM (yesterday) Jan 19
to Tom Lukaszewicz, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Tom Lukaszewicz

New activity on the change

Open in Gerrit

Related details

Attention is currently required from:
  • Tom Lukaszewicz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I6bf6c4a9bfcbd3241805563b3a5cd49eca44dc01
Gerrit-Change-Number: 7488991
Gerrit-PatchSet: 7
Gerrit-Owner: Lichen Liu <lich...@microsoft.com>
Gerrit-Reviewer: Lichen Liu <lich...@microsoft.com>
Gerrit-Reviewer: Tom Lukaszewicz <tl...@chromium.org>
Gerrit-Attention: Tom Lukaszewicz <tl...@chromium.org>
Gerrit-Comment-Date: Mon, 19 Jan 2026 06:40:36 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Tom Lukaszewicz (Gerrit)

unread,
Jan 19, 2026, 5:15:55 PM (13 hours ago) Jan 19
to Lichen Liu, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
Attention needed from Lichen Liu

Tom Lukaszewicz added 2 comments

File chrome/browser/devtools/devtools_window.cc
Line 2016, Patchset 7 (Latest): gfx::NativeWindow opener_window = gfx::NativeWindow();
Tom Lukaszewicz . unresolved

Are we able to instead perhaps retain the session id of the inspected Browser, and when the devtools window is destroyed simply activate the inspected Browser? We could probably keep this detail local to `devtools_window.cc`

File chrome/browser/ui/views/frame/browser_widget.cc
Line 158, Patchset 7 (Latest):#if BUILDFLAG(IS_MAC)
// Set parent/opener window relationship for DevTools windows on Mac.
// When the DevTools window closes, focus returns to the opener window
// (e.g., the PWA window that opened it) instead of the main browser.
gfx::NativeWindow opener = browser->create_params().opener_window;
if (opener) {
params.parent = gfx::GetViewForWindow(opener);
}
#endif
Tom Lukaszewicz . unresolved

I'm not sure we want to encourage parent-child relationships between browsers (we end up with awkward interactions involving things like paint-as-active and in general it's not something we should have Browsers do).

Open in Gerrit

Related details

Attention is currently required from:
  • Lichen Liu
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement is not satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement is not satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I6bf6c4a9bfcbd3241805563b3a5cd49eca44dc01
    Gerrit-Change-Number: 7488991
    Gerrit-PatchSet: 7
    Gerrit-Owner: Lichen Liu <lich...@microsoft.com>
    Gerrit-Reviewer: Lichen Liu <lich...@microsoft.com>
    Gerrit-Reviewer: Tom Lukaszewicz <tl...@chromium.org>
    Gerrit-Attention: Lichen Liu <lich...@microsoft.com>
    Gerrit-Comment-Date: Mon, 19 Jan 2026 22:15:20 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Lichen Liu (Gerrit)

    unread,
    3:38 AM (3 hours ago) 3:38 AM
    to Tom Lukaszewicz, Chromium LUCI CQ, chromium...@chromium.org, devtools...@chromium.org
    Attention needed from Tom Lukaszewicz

    Lichen Liu added 2 comments

    File chrome/browser/devtools/devtools_window.cc
    Line 2016, Patchset 7: gfx::NativeWindow opener_window = gfx::NativeWindow();
    Tom Lukaszewicz . resolved

    Are we able to instead perhaps retain the session id of the inspected Browser, and when the devtools window is destroyed simply activate the inspected Browser? We could probably keep this detail local to `devtools_window.cc`

    Lichen Liu

    Good idea! Updated the code to add `inspected_browser_session_id_` to `DevToolsWindow`. Thanks!

    File chrome/browser/ui/views/frame/browser_widget.cc
    Line 158, Patchset 7:#if BUILDFLAG(IS_MAC)

    // Set parent/opener window relationship for DevTools windows on Mac.
    // When the DevTools window closes, focus returns to the opener window
    // (e.g., the PWA window that opened it) instead of the main browser.
    gfx::NativeWindow opener = browser->create_params().opener_window;
    if (opener) {
    params.parent = gfx::GetViewForWindow(opener);
    }
    #endif
    Tom Lukaszewicz . resolved

    I'm not sure we want to encourage parent-child relationships between browsers (we end up with awkward interactions involving things like paint-as-active and in general it's not something we should have Browsers do).

    Lichen Liu

    Thanks for reminding, removed the parent related code.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Tom Lukaszewicz
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement is not satisfiedCode-Review
      • requirement is not satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I6bf6c4a9bfcbd3241805563b3a5cd49eca44dc01
      Gerrit-Change-Number: 7488991
      Gerrit-PatchSet: 10
      Gerrit-Owner: Lichen Liu <lich...@microsoft.com>
      Gerrit-Reviewer: Lichen Liu <lich...@microsoft.com>
      Gerrit-Reviewer: Tom Lukaszewicz <tl...@chromium.org>
      Gerrit-Attention: Tom Lukaszewicz <tl...@chromium.org>
      Gerrit-Comment-Date: Tue, 20 Jan 2026 08:38:15 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Tom Lukaszewicz <tl...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages