Closed
Bug 1295072
Opened 8 years ago
Closed 8 years ago
Awesomebar doesn't get focus when creating tab from chrome.tabs.create()
Categories
(WebExtensions :: Frontend, defect, P3)
WebExtensions
Frontend
Tracking
(firefox54 fixed)
RESOLVED
FIXED
mozilla54
Tracking | Status | |
---|---|---|
firefox54 | --- | fixed |
People
(Reporter: shinglyu, Assigned: zombie)
References
Details
(Whiteboard: [design-decision-approved]triaged)
Attachments
(1 file)
STR:
Create a tab using WebExtension's chrome.tabs.create({})
Expected:
A new tab opens up, the focus is on the address bar (awesomebar)
Actual:
The focus is not on the address bar
Notes:
Tested on Chromium, the focus will be on the address bar.
Environment:
Firefox 50.0a2
Ubuntu 16.04 64bit
Updated•8 years ago
|
Priority: -- → P3
Whiteboard: [design-decision-needed]
Updated•8 years ago
|
Component: WebExtensions → WebExtensions: Frontend
Updated•8 years ago
|
Whiteboard: [design-decision-needed] → [design-decision-approved]triaged
Comment 1•8 years ago
|
||
Could this be made optional / parametrised, or otherwise controllable via API?
For my New Tab Homepage add-on (which loads the user's homepage instead of about:newtab) one of the most requested features is to place focus with the page content, i.e. so if their homepage is Google, the search field will receive focus instead of the Awesomebar.
I've never implemented this because it was tricky to get right, but the New Tab Override add-on does solve this problem and would presumably need the same functionality.
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → tomica
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Attachment #8827184 -
Flags: review?(kmaglione+bmo)
Assignee | ||
Comment 3•8 years ago
|
||
(In reply to Ben Basson from comment #1)
> Could this be made optional
It doesn't need to be. This is only meant to focus the urlbar when opening an "empty" tab. And even then, the content can take the focus with a simple <input autofocus> field, or using javascript .focus() method. In fact, that's the only way this could work.
Comment 4•8 years ago
|
||
I'd be fine with that if it works. The current implementation doesn't seem consistent in its behaviour, judging by my inbox full of support emails.
All my add-on does now is override the new tab page using nsIAboutNewTabService (previously NewTabURL.jsm) and I get mixed reports of Google taking focus vs. the URL bar.
Assignee | ||
Comment 5•8 years ago
|
||
Well, that's a different bug then. While working on this, I tested your use case: content is able reliably to take focus via methods described above.
The ability for web extensions to override the newtab page is being worked on in bug 1234150. Once that lands, if this is still a problem, please file a bug.
Comment 6•8 years ago
|
||
Comment on attachment 8827184 [details]
Bug 1295072 - Focus urlbar after opening an empty new tab
Shane, can you look over this?
Thanks.
Attachment #8827184 -
Flags: feedback?(mixedpuppy)
Comment 7•8 years ago
|
||
mozreview-review |
Comment on attachment 8827184 [details]
Bug 1295072 - Focus urlbar after opening an empty new tab
https://reviewboard.mozilla.org/r/104946/#review108758
Looks straightforward. f+
::: browser/components/extensions/test/browser/browser_ext_tabs_create.js:192
(Diff revision 1)
> +
> + // Test urlbar is focused after opening an empty tab
> + extension.sendMessage("create", {});
> + const tab2 = yield extension.awaitMessage("result");
> +
> + is(document.activeElement.tagName, "html:input", "Input element focused");
Do we need to be this granular, or can we just check gURLBar.focused?
Updated•8 years ago
|
Attachment #8827184 -
Flags: feedback?(mixedpuppy) → feedback+
Comment hidden (mozreview-request) |
Assignee | ||
Comment 9•8 years ago
|
||
mozreview-review-reply |
Comment on attachment 8827184 [details]
Bug 1295072 - Focus urlbar after opening an empty new tab
https://reviewboard.mozilla.org/r/104946/#review108758
> Do we need to be this granular, or can we just check gURLBar.focused?
We don't, it's obvious I was strugling a bit to to find the right check, thanks.
Comment 10•8 years ago
|
||
(In reply to Tomislav Jovanovic :zombie from comment #9)
> > Do we need to be this granular, or can we just check gURLBar.focused?
>
> We don't, it's obvious I was strugling a bit to to find the right check,
> thanks.
yeah, this code base is a continual struggle. Once you think you know something, someone else rewrites it.
Comment 11•8 years ago
|
||
mozreview-review |
Comment on attachment 8827184 [details]
Bug 1295072 - Focus urlbar after opening an empty new tab
https://reviewboard.mozilla.org/r/104946/#review110832
Attachment #8827184 -
Flags: review?(kmaglione+bmo) → review+
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed
Comment hidden (mozreview-request) |
Comment 13•8 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/70253d6678af
Focus urlbar after opening an empty new tab r=kmag
Keywords: checkin-needed
Comment 14•8 years ago
|
||
Backed out in https://hg.mozilla.org/integration/autoland/rev/951bab16551a for https://treeherder.mozilla.org/logviewer.html#?job_id=74613184&repo=autoland (so far, all e10s, Linux32 opt, Linux64 opt, Linux64 debug)
Comment hidden (mozreview-request) |
Assignee | ||
Comment 16•8 years ago
|
||
(In reply to Shane Caraveo (:mixedpuppy) from comment #7)
> Do we need to be this granular, or can we just check gURLBar.focused?
Sigh, testing for gURLBar.focused doesn't seem to work on Linux for some reason.
Checking document.activeElement seems to work as expected cross-platform, and since this is just test code, I reverted the test to my original patch (r=testonly).
Keywords: checkin-needed
Comment 17•8 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/2b5a94ac86a6
Focus urlbar after opening an empty new tab r=kmag
Keywords: checkin-needed
Comment 18•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•