mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
UI/AppKit: Auto-focus location bar when opening new tabs on macOS
When a new tab is created, the location bar should automatically receive keyboard focus so users can immediately start typing a URL. However, the onURLChange callback was stealing focus back to the web view when loading the new tab page. This fix: 1. Calls focusLocationToolbarItem when activating a new tab 2. Prevents onURLChange from stealing focus when loading the new tab page URL Fixes #1512
This commit is contained in:
parent
aac387bcc6
commit
5b7c9af340
Notes:
github-actions[bot]
2025-11-26 09:49:09 +00:00
Author: https://github.com/s21v1d9p
Commit: 5b7c9af340
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6924
Reviewed-by: https://github.com/gmta ✅
2 changed files with 6 additions and 1 deletions
|
|
@ -189,6 +189,7 @@
|
|||
|
||||
if (activate_tab == Web::HTML::ActivateTab::Yes) {
|
||||
[[controller window] orderFrontRegardless];
|
||||
[controller focusLocationToolbarItem];
|
||||
}
|
||||
|
||||
[self.managed_tabs addObject:controller];
|
||||
|
|
|
|||
|
|
@ -145,7 +145,11 @@ static NSString* const TOOLBAR_TAB_OVERVIEW_IDENTIFIER = @"ToolbarTabOverviewIde
|
|||
- (void)onURLChange:(URL::URL const&)url
|
||||
{
|
||||
[self setLocationFieldText:url.serialize()];
|
||||
|
||||
// Don't steal focus from the location bar when loading the new tab page
|
||||
if (url != WebView::Application::settings().new_tab_page_url()) {
|
||||
[self.window makeFirstResponder:[self tab].web_view];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)clearHistory
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue