Open Bug 530203 Opened 15 years ago Updated 2 years ago

improve heuristic used for complicated cases when closing a tab that spawned links in new tabs

Categories

(Firefox :: Tabbed Browser, defect)

defect

Tracking

()

People

(Reporter: zpao, Unassigned)

References

()

Details

Bug 465673 changed behavior so that tabs opened next to the current tab. Per a discussion on d.a.f (http://groups.google.com/group/mozilla.dev.apps.firefox/browse_thread/thread/30b8bb749e061da0), we can improve the heuristic we used so that we handle the complicated cases better.
Blocks: 578327
Most of the complicated cases surround links that are forced to open in new tabs as opposed to those that do on their own, correct? Presently, if I have a tab "B" with a link that opens in a new window using target=blank or window.open (caps indicates focused tab): a B c d a b B1 c d (link opens new window with focus) a B c d (closing the tab returns to parent) Our current heuristic fails, however, when I use the link in tab "B" and that page has a link which also opens in a new window: a B c d a b B1 c d (link opens new window with focus) a b b1 B11 c d (link opens new window with focus) a b B1 c d (close returns to parent) a b C d (close to right) Here I would have expected to close back to my parent, but we've disposed that information (perhaps prematurely) and we close to right. (You can use http://beltzner.ca/test/testA.html to try this out - it's a page with a link that uses target="_blank") This could be solved by either always closing to the left (which is unlike other browsers) or maintaining the parenting information. When a user forces a link to open multiple links in new tabs (without focus) things get more complicated. For a tab B where three such links are forced into tabs: a B c d a B b1 c d a B b1 b2 c d a B b1 b2 b3 c d Now the close behaviour is pretty dependent on where the user places focus, whether they re-order tabs, etc. Let's consider the set {b1,b2,b3} to all understand that their parent was "b". // Heuristic 1 If focus is switch to any of {b1,b2,b3}, closing a tab should switch to: - tab b* to the right, if available - otherwise tab b* to the left - otherwise tab b (the parent) // Heuristic 2 If the user opens a new tab from any of the tabs in {b1, b2, b3}, those should be added to the set of tabs for which heuristic 1 applies. // Heuristic 3 If the user re-orders tabs such that a new tab is inserted into the set {b1,b2,b3} (so either moves b* outside beyond another tab, or moves a tab inside the set) then we stop remembering parenting information. // Heuristic 4 If the user changes tab focus to a tab outside the set, then we stop remembering parenting information. This includes creating a new tab. I think that all should work. The only thing that might be wrong is the behaviour around creating a new tab.
Whether or not this behavior is the right option, it's worth noting that it would create a zig-zag effect with enough tabs that could seem unpredictable. If the user begins at the end state above, switches focus to one of the b* tabs, and creates two more spawning tabs, would you consider the b** tabs to be a family within the b* family, and close tabs within one family completely before moving to the next? Behavior would be: a (B) b1 b2 b3 c d a b b1 (B2) b3 c d (switch focus) a b b1 b2 (B2a) b3 c d (new tab from b2) a b b1 b2 b2a (B2b) b3 c d (new tab from b2a) a b b1 b2 (B2a) b2b b3 c d (focus switched back to b2a) User now presses "close tab" many times in a row. This would be the behavior described in Comment 1 a b b1 b2 (B2a) b2b b3 c d a b b1 b2 (B2b) b3 c d (focus moves right) a b b1 (B2) b3 c d (focus moves left) a b b1 (B3) c d (focus moves right) a b (B1) c d (focus moves left) a (B) c d (focus moves left) a (C) d (focus moves right)
(In reply to comment #2) > Whether or not this behavior is the right option, it's worth noting that it > would create a zig-zag effect with enough tabs that could seem unpredictable. Yeah, that might be true. We can (and should!) identify edge-y cases. The bit I worry about most is the case where a bunch of nested sets have been opened, and then someone forgets the parentage, and closing tabs seems random. > a family within the b* family, and close tabs within one family completely > before moving to the next? That makes most sense to me, yes. Perhaps we should nest the heuristic, as well. So if you open a set within a set, the heuristic only holds if you then close the inner set before the outer set. (ugh)
Summary: Improve heuristics for determining tab opening placement → improve heuristic used for complicated cases when closing a tabs that was spawned links in another tab
Summary: improve heuristic used for complicated cases when closing a tabs that was spawned links in another tab → improve heuristic used for complicated cases when closing a tab that spawned links in new tabs
Any news here?
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.