Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically focus search bar on new tab #503

Open
victrme opened this issue Dec 3, 2024 · 3 comments
Open

Automatically focus search bar on new tab #503

victrme opened this issue Dec 3, 2024 · 3 comments

Comments

@victrme
Copy link
Owner

victrme commented Dec 3, 2024

Browsers are focusing the address bar when creating a new tab (about:newtab on Firefox, chrome://newtab on Chromium). This behavior happens before the new tab page is loaded, which means we do not have control over it.

This can be tweaked by quickly reloading the page with a search query like ../index.html?x=0, however this really slows down the page, and is not 100% guaranteed to work.

A faster way to do this trick is to use browser.tabs.update like New Tab Override. This can be almost as fast as the default page on slower devices, and requires the "tabs" permission to work.

@Gitoffthelawn
Copy link
Contributor

How about only perform browser.tabs.update when Bonjourr's search bar is displayed? This will improve the performance when Bonjourr's search bar is disabled via its settings.

@victrme
Copy link
Owner Author

victrme commented Dec 4, 2024

Yes this is the plan. We might add a "Focus search bar on new tabs" option to make sure the page is never slowed down by default.

@Gitoffthelawn
Copy link
Contributor

Yes this is the plan. We might add a "Focus search bar on new tabs" option to make sure the page is never slowed down by default.

That sounds great. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Not planned
Development

No branches or pull requests

2 participants