sailfishos / sailfish-browser

Sailfish Browser
https://github.com/sailfishos/sailfish-browser/wiki/Sailfish-Browser-wiki
Mozilla Public License 2.0
305 stars 86 forks source link

[browser] Activate recently used tab when closing the active tab. Fixes JB#56968 #975

Closed rainemak closed 2 years ago

rainemak commented 2 years ago

When closing the active tab that was not created by JavaScript, activate the tab that was used before the tab that got closed.

If tab was created by JavaScript, the parent tab of the child is activated.

From user point of view this should result more understandable activation as user likely remembers the tab that she was using before current active tab.

llewelld commented 2 years ago

A small suggestion for the commit message and title: Active recently -> Activate recently

rainemak commented 2 years ago

Fixed review comments and added commit on top that renames findTabId(uniqueId) const to tabId(uniqueId) const

rainemak commented 2 years ago

In this case, tab 0 opens, when I'd expect tab 1 (the last active tab) to open. I guess it's because findTabIndex(parentId) is returning -1.

It's a very minor thing, so I would approve anyway if you think it's not worth making a change for this.

Need to digest your comments first but I do think that there are plausible cases when selecting whether to activate parent tab or previously used tab for example if after using a child tab (A) you switch a tab manually and then return back to the child tab (A) and closing it => what should we activate?. However, I feeling is that this already improves the experience quite a bit but that's my own thought / feeling especially with https://github.com/sailfishos/sailfish-browser/pull/976 as well.

rainemak commented 2 years ago

I think your comments are very much valid. I'll add check for parent tab id and based on that fallback to the previously used tab.

rainemak commented 2 years ago

It might actually be that always activating most recently used tab would be the best. Just wondering but that would match the original thinking that I had in mind.