mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: add focusOnNavigation flag to WebPreferences (#49425)
* feat: add focusOnNavigation webPreference * WebContentsView tests * fix * fix
This commit is contained in:
@@ -2098,6 +2098,10 @@ void WebContents::ReadyToCommitNavigation(
|
||||
// Only focus for top-level contents.
|
||||
if (type_ != Type::kBrowserWindow)
|
||||
return;
|
||||
// Don't focus if focusOnNavigation is disabled.
|
||||
auto* prefs = WebContentsPreferences::From(web_contents());
|
||||
if (prefs && !prefs->ShouldFocusOnNavigation())
|
||||
return;
|
||||
web_contents()->SetInitialFocus();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user