Closed Bug 344508 Opened 18 years ago Closed 15 years ago

Firefox incorrectly demonstrates 1.x behaviour when a tab is closed

Categories

(Firefox :: Tabbed Browser, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: ventnor.bugzilla, Unassigned)

References

Details

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b1) Gecko/20060710 Firefox/2.0b1

When you open a new tab, then close it, Firefox reverts to the tab that was in focus when you open it. However (pay attention now :) ), if you browse other tabs while that opened tab is still open, select the opened tab from a tab OTHER than the tab you opened it from, and close it, Firefox selects the tab to the left, the old behaviour. It isn't clear now but it will be once you read how to reproduce it.

Reproducible: Always

Steps to Reproduce:
1. Open at least 3 tabs. Make sure the 1st tab is selected.
2. Now open a 4th. Select that 4th tab.
3. Close it. Firefox 2 goes back to the 1st tab. Good.
4. Open a 4th tab again from the 1st tab.
5. This time, select the 2nd tab, then focus the 4th tab again.
6. Close the 4th tab. Firefox focuses the 3rd (?!!) tab.


Actual Results:  
Obviously its reverted back to its original behaviour, opening the tab to the left.

Expected Results:  
Firefox 2 should focus on the 2nd tab, since that was the tab last in focus before the 4th tab got closed.

Its a mouthful, I know. :) I'm not 100% sure but I think the expected result is the way Opera behaves. IMO, this is how Firefox 2 should behave.
(In reply to comment #0)
>
> Steps to Reproduce:
> 1. Open at least 3 tabs. Make sure the 1st tab is selected.
> 2. Now open a 4th. Select that 4th tab.
> 3. Close it. Firefox 2 goes back to the 1st tab. Good.

It goes to the third tab here with Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b1) Gecko/20060712 BonEcho/2.0b1


I see that you're talking about bookmarks opened in tabs..
(In reply to comment #1)
> (In reply to comment #0)
> >
> > Steps to Reproduce:
> > 1. Open at least 3 tabs. Make sure the 1st tab is selected.
> > 2. Now open a 4th. Select that 4th tab.
> > 3. Close it. Firefox 2 goes back to the 1st tab. Good.
> 
> It goes to the third tab here with Mozilla/5.0 (Windows; U; Windows NT 5.1;
> en-US; rv:1.8.1b1) Gecko/20060712 BonEcho/2.0b1
> 

Is your browser.tabs.selectOwnerOnClose set to false? Ignore the "Select that 4th tab" in step 2, since Fx will go to the 4th tab when you open it anyway.
(In reply to comment #2)
> I see that you're talking about bookmarks opened in tabs..
> 

No. It even happens with 4 blank tabs.
Tested with default settings.
(In reply to comment #5)
> Tested with default settings.
> 

Thats weird. Under default settings, when you open a tab in Fx2 then close it immediately after, Fx2 should return to the parent tab. Thats basically what step 1-3 is to make sure that works.
It makes indeed a huge difference if you are talking about tabs opened from links, tabs opened from bookmarks or tabs opened from the toolbar (file > new tab) that you fill in later. I think the tab-focus-after-close behaviour is based on the expected behaviour of the user and you can change this with the browser.tabs.selectOwnerOnClose. In that case it will allways focus to the left of the closed tab as far as I can see. 
It appears all to be about the question: is the new tab opened in the foreground or in the background? New tabs and bookmarks are opened with focus by default, and middle-clicked links are opened in the background.

http://wiki.mozilla.org/Link_Targeting#Moving_Focus_after_Closing_Tabs

One potential way of detecting this would be to give focus to the previously selected tab when:

    * a new tab has opened with focus
    * focus does not move from that tab before it is closed 
(In reply to comment #7)
> It makes indeed a huge difference if you are talking about tabs opened from
> links, tabs opened from bookmarks or tabs opened from the toolbar (file > new
> tab) that you fill in later. I think the tab-focus-after-close behaviour is
> based on the expected behaviour of the user and you can change this with the
> browser.tabs.selectOwnerOnClose. In that case it will allways focus to the left
> of the closed tab as far as I can see. 
> 

I guess I should have made it clearer, I used the New Tab function, Ctrl+T. The tab should get focus automatically.
Blocks: 345028
I can reproduce this exactly in Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1b2) Gecko/20060825 BonEcho/2.0b2.  I agree that Firefox should open the last focused tab when a tab is closed.

Status: UNCONFIRMED → NEW
Ever confirmed: true
Until this bug is not fixed FLST extension can be used - http://gorgias.de/mfe/#flst or Focus Last Selected Tab - http://www.gozer.org/mozilla/extensions/

BTW this bug can still be reproduced on latest trunk - Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.9a8pre) Gecko/2007081205 Minefield/3.0a8pre
I support the heuristic suggested in Comment #8.

When you middle-click a link to open a new tab, but you've left unchecked the option to switch to new tabs immediately (so as to make it easy to open several links from a parent tab), then when you switch to a child tab and subsequently close it, focus should revert to the parent tab (unless it has been closed, in which case focus should revert to either the rightmost tab or the oldest child tab).

3.0.11 does not behave in this way. Focus always switches to the rightmost tab, and I usually have to take some time to relocate the parent tab so that I can switch back.
comment 8 is how this is currently implemented:

If you open a new foreground tab (such as Accel+Shift+Click, a redirected popup window->tab such as window.open, or a bookmark via middleclick) and then close that tab _without_ switching to any other tabs. we will return to the previous tab.  If you middle-click a link, it opens the tab in the background and this heuristic is not triggered, and we close ignoring any "parent" info.
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
(In reply to comment #13)
> that tab _without_ switching to any other tabs.

also _without_ opening any other tabs in the background.
middle-clicking on links from the new foreground tab to open them in the background, will also cause the foreground tab to lose its parent.
is this intended?
See bug 374165 for a relevant suggestion.
mike/ria could you confirm the behavior in comment #14 is by design, or should i open a new bug for this?
i submitted Bug 518002 per comment #14
You need to log in before you can comment on or make changes to this bug.