browser.tabs.update with URL places focus in URL bar rather than loaded content




WebExtensions: General
28 days ago
7 hours ago


(Reporter: Ben Basson, Unassigned)



Firefox Tracking Flags

(firefox57 wontfix)


(Whiteboard: [design-decision-needed])



28 days ago
When you press the "Home" button, Firefox loads the homepage in your current tab and gives focus to the content, e.g. in the case of Google, the search field receives focus. 

If I try to do this via browser.tabs.update(), the cursor goes into the URL bar instead, prior to the URL.

This request is similar, but subtly different to the request in bug 1409675, which suggests that the value in the URL bar should be selected.

Would it be possible to add an additional option to browser.tabs.update() so we can specify this behaviour? Something like

  browser.tabs.update({"url": "", "focus": "content"});

With possible options: 

  "content" - the loaded page
  "url" - the URL bar (which should also select the text in full, as per bug 1409675) 

I can't think of any good reason to have an option for just plonking the cursor at the start of the URL as it does now.

This is literally the most requested feature for my New Tab Homepage add-on, to the tune of probably hundreds of emails historically. I thought I had a way to do it with Web Extensions (via browser.tabs.executeScript) but it doesn't work.

I note that the (web ext) add-on New Tab Override works around this by removing the tab that was just opened and creating a new one, so browser.tabs.create() provides focus to content in the way you would expect. I'm reluctant to implement this workaround because it's pretty jarring UI behaviour.

Comment 1

28 days ago
Just to add to the above, middle clicking the home button also exhibits the behaviour you'd expect, e.g. focus is given to content when the new tab is opened.


27 days ago
status-firefox57: --- → wontfix


19 days ago
Priority: -- → P5
Whiteboard: [design-decision-needed]
You need to log in before you can comment on or make changes to this bug.