From 41bcdd71fee4f537e33f2a74dda60a7849b6f48e Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 13 Nov 2025 16:08:29 +0100 Subject: [PATCH] fix: the parent window remained interactive after the modal window was opened (#48866) fix: fix the issue where the parent window remained interactive after the modal window was opened in somecases. Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Bill Shen <15865969+cucbin@users.noreply.github.com> --- shell/browser/native_window.cc | 3 ++- shell/browser/native_window_views.cc | 2 +- shell/common/options_switches.h | 2 ++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index f69be2feb605..5e02ef25c60a 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -104,7 +104,8 @@ NativeWindow::NativeWindow(const gin_helper::Dictionary& options, transparent_{options.ValueOrDefault(options::kTransparent, false)}, enable_larger_than_screen_{ options.ValueOrDefault(options::kEnableLargerThanScreen, false)}, - is_modal_{parent != nullptr && options.ValueOrDefault("modal", false)}, + is_modal_{parent != nullptr && + options.ValueOrDefault(options::kModal, false)}, has_frame_{options.ValueOrDefault(options::kFrame, true) && title_bar_style_ == TitleBarStyle::kNormal}, parent_{parent} { diff --git a/shell/browser/native_window_views.cc b/shell/browser/native_window_views.cc index e8af8eca8ab0..e027da09fd19 100644 --- a/shell/browser/native_window_views.cc +++ b/shell/browser/native_window_views.cc @@ -555,7 +555,7 @@ bool NativeWindowViews::IsFocused() const { } void NativeWindowViews::Show() { - if (is_modal() && NativeWindow::parent() && !widget()->IsVisible()) + if (is_modal() && NativeWindow::parent()) static_cast(parent())->IncrementChildModals(); widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect()); diff --git a/shell/common/options_switches.h b/shell/common/options_switches.h index b07313f033ec..9c421f198c5f 100644 --- a/shell/common/options_switches.h +++ b/shell/common/options_switches.h @@ -219,6 +219,8 @@ inline constexpr std::string_view kSpellcheck = "spellcheck"; inline constexpr std::string_view kEnableDeprecatedPaste = "enableDeprecatedPaste"; +inline constexpr std::string_view kModal = "modal"; + } // namespace options // Following are actually command line switches, should be moved to other files.