Restore focus on parent tab when closing child tab

Bug #1664990 reported by Olivier Tilloy
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
webbrowser-app (Ubuntu)
In Progress
Medium
Florian Boucault

Bug Description

(follow-up to https://code.launchpad.net/~fboucault/webbrowser-app/background_open_tabs_adjacent/+merge/316226)

In chromium on desktop, when opening a link in a new tab (for instance when Ctrl+clicking on a hyperlink), the new tab is open next to the parent tab. When closing that child tab, the parent tab is the one that becomes current.
In webbrowser-app, when closing the child tab, the next one in the list becomes current. It would be nice if webbrowser-app implemented the same behaviour as chromium.

Steps to reproduce:
 1) Start webbrowser-app, and open two tabs, e.g. http://example.org and http://start.ubuntu.com
 2) Focus the first tab (example.org) and right click on the "More information…" link (this opens a new tab in second position and focuses it
 3) Press Ctrl+W to close the current tab

Expected result: the first tab (example.org) is the one that gets focused.

Actual result: the second tab (start.ubuntu.com) is the one that gets focused.

Related branches

Olivier Tilloy (osomon)
Changed in webbrowser-app (Ubuntu):
assignee: nobody → Florian Boucault (fboucault)
importance: Undecided → Medium
status: New → Triaged
Changed in webbrowser-app (Ubuntu):
status: Triaged → In Progress
Revision history for this message
Olivier Tilloy (osomon) wrote :

I looked into chromium’s implementation, and it’s a bit more complex than what I described in the description. Details are in TabStripModelOrderController::DetermineNewSelectedIndex(…)¹.

I think it would be worth identifying what in chromium’s implementation we want to replicate.
One thing that wasn’t reported as part of this bug is that when opening background tabs from a given page, they should be placed to the right of the opener, in sequence (i.e. if I open B, C and D as background tabs from A, the order of the tabs should be A-B-C-D, not A-D-C-B as it is currently). This should probably be implemented as part of this bug.

¹ https://cs.chromium.org/chromium/src/chrome/browser/ui/tabs/tab_strip_model_order_controller.cc?l=52

Revision history for this message
Florian Boucault (fboucault) wrote :

The other thing from that chromium code is that the closing order should be different. In the case you describe of having opened B, C and D background tabs. Closing D should not focus A (which created it) but instead focus C.

Revision history for this message
Olivier Tilloy (osomon) wrote :

Indeed, my original request was a naive approach, which is why I suggested in comment #1 identifying what in chromium’s implementation we want to replicate.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.