Ctrl W not close app

From MozillaWiki
Jump to: navigation, search

Discuss: Ctrl-W on last tab should not close the window. Ref: bug in bugzilla.

Proposed change

Ctrl+w should behave as the tab bar's close button already does, and as Ctrl+F4 already does, and as right click on tab -> "Close tab" already does. Ctrl+W and File->Close Tab should be consistent with every other tab-closing method, and close the tab, but not the window.

In detail:

  • Ctrl+W will close the selected tab, as per currently, until only one tab is left.
  • When that tab is left, Ctrl+W will blank the tab and clear session history (basically a quicker way of closing the tab and creating a new one).
  • If Ctrl+W is pressed again, treat as above - i.e. you still have the window open, with one blank tab, with no session history.

Arguments in favour and against


  • Consistency: Close page button in most editors and other applications is ctrl-W, close application button is alt-f4. Only in Mozilla crtl-w closes application.
  • Inconsistency: Close tab button and Ctrl-W are currently inconsistent ("close tab button" keeps app open, ctrl-W closes the (possibly last) window). Also in the same way, currently inconsistent with right click on tab -> "Close tab" (which cannot close the app). Also in the same way, currently inconsistent with middle button click on tab (closes tab, but not the window, even if only tab left).
    • ...but all these actions are graphically targeted at the tab; Ctrl-W is not.
  • There's already a keyboard shortcut for closing the window (SHIFT+CTRL+W).
    • ...but that's not at all what Ctrl-W does, conceptually.
  • Surprise: The current behaviour is often surprising - "Whoa! Where did my browser window just go?". New behaviour will not be surprising to the new user in this way.
  • Precedent in other multi-tabbed browsers: This is how tab closing via Ctrl-W works in IE7, NetCaptor, and Opera, among others.
    • ...but all these apps display a single-tab tab bar by default; Firefox does not. (see also related proposal below)
    • ...IE7 (released version) closes the app when using Ctrl-W to close the last tab
  • Clarity: Closing the tab and closing the window are two very different things - one means "I'm done with the current block of information, but this app is still useful to me", and the other means "this entire app is no longer of any use to me" - they are conceptually different things. At the moment this is being muddied by having the meaning of Ctrl-W change between these two things, depending on context.
    • ...but what if "I'm done with the current block of information, and the window is as useful as the documents it contains"? The proposal requires use of different keybindings case by case, when the same thing is meant.
    • ...The application doesn't necessarily close when the browser window closes. You could have other browser windows, download windows, etc open. You could also be on OS X where the app is still running without any windows present.
  • Easier to close all tabs without closing the browser (by holding Ctrl+W rather than Ctrl-F4).
  • Firefox supports multiwindow tabless browsing; ctrl-w closing the document but not the window is consistent with applications such as MS Office 2000 and GEdit (GNOME text editor; it will actually close a window with Ctrl-W, but not the last window).
  • Currently, when I'm done with a tab, I cannot always safely press Ctrl+W, and assume that the right thing will happen (the tab will close, but the window will stay open). As I have to press a different shortcut to close a tab when it is the only one left, I sometimes accidentally press the Ctrl-W shortcut without realizing that it will close the window.
  • Blanking a tab is a useful action if you browse in single-window-mode (as the window is long-lived, whereas the tab is disposable - so we want the window to stick around, but need a way of clearing the content from the last tab when we are done with it, without closing the window)
  • For people who usually use tabs rather than windows, it's nice to have an easy-to-press shortcut (Ctrl+W) to close only the tab.


  • It's a change in the User Interface from how it was in Firefox 1.0 and 1.5.
  • Closing a tab that creates a new blank tab is arguably not closing a tab.
  • Users on UNIX systems wanting mouse keyboard bindings may want a key binding that uses two keys rather than 3 to close the window (although Alt-F4 may do this?).
  • There's already a keyboard shortcut for closing the tab (ctrl-F4). There is no other keyboard shortcut for what Ctrl-W currently does.
  • Firefox supports multiwindow tabless browsing; ctrl-w not closing the window along with its directly contained document is inconsistent with IE6 and other tabless applications.
  • The current document-centric ctrl-w behavior discards a window, as it does a tab, when the window no longer contains a document. The proposal makes the window widget "heavier" favoring it over the document concept; instead of the application getting out of the way when the user is done with the document, it demands that the user deal specifically with the window to close it with e.g. a different keybinding.
  • Currently, when I'm done with a document, I can safely press Ctrl+W, and the right thing will happen (the tab will close, or the window will close). If I had to press a different shortcut to close a window, I'd sometimes accidentally press the shortcut to close a window without realizing that I had other tabs open.
  • Blanking a tab isn't an especially useful action.
  • For people who usually use windows rather than tabs, it's nice to have an easy-to-press shortcut (Ctrl+W) to close the window.
  • 1 for the price of 2: If I'm done with the current document, and don't want to open a new one at this time, the proposal creates an additional step that I need to perform: either (a) determine whether multiple tabs are open, to decide whether to close a tab or a window; or (b) after just closing a tab, if a blank useless window remains, close it.
  • Most windows apps use crtl-w as a close command, including IE6, making this unintuitive behavior.
    • OS X apps as well
  • A popup window is not generally recognized as a window (no menu bar, tab bar, bookmark section...) but becomes one when closing the tab by ctrl-w by showing a tab bar. A popup should be closable by ctrl-w - so how to tell the difference between popup and main window?
    • In addition, think of mouse gestures: These become worthless if I can't close a popup with the same gesture as closing a tab.
  • If I have Firefox set to not show the tab bar when there's only one tab then there are effectively no tabs. There's no hint to the user that they're in a tab, its just a regular window. In that case ctrl+w not closing the window is bizarre and confusing.

Should this be a preference?

If finding a single behaviour that works for everyone is intractable, then perhaps it should be a boolean preference between the current behaviour and the behaviour described above in the use-case?

Pro having a pref

  • It would allow the user to select the best trade-off of the pros and cons above, at their discretion.
  • It would allow consistency to different HUI guidelines for example Apple vs Gnome.
  • There may be an element of the religious emacs-vs-vi / pro-life-versus-pro-choice debate to this: People who care tend to have a strong preference one way or the other, depending on their personal browsing style and which UI they think works best, and it may be that no amount of discussion will change that viewpoint. In particular, do you mostly browse with tabless single windows, or mostly with a multi-tabbed single window? Perhaps whichever mode you are closest to will drive your assumptions the most about expected behaviour.

Con having a pref

  • It would introduce yet another preference, when the overall direction seems to be towards reducing the number of preferences.

Alternative suggestions

Behavior dependent on tab bar visibility

Instead of creating yet-another-pref, why not have this behavior dependent on tab bar visibility: if you choose to not hide the tab bar with only one tab left, you stay in tabbed browsing mode and Ctrl+W blanks the tab - mimicking an MDI application; otherwise you leave tabbed browsing mode and Ctrl+W closes the window as other SDI applications are closed (e.g. MSIE and Windows Explorer). --zeniko 14:59, 14 Mar 2006 (PST)

After going through the pro/con points again, I think this might in fact be a surprisingly reasonable idea, as it seems the arguments are rooted in two distinct modes of usage:

  • Firefox as document viewer: ...and what use is a blank document viewer, and why would I ever want to see one? Just because it happens to be able to contain multiple documents in one window, doesn't mean it should flaunt its empty document containers at me. Windows are cheap.
  • Firefox as tabbed browsing shell: ...and who wants to accidentally lose their shell? That's like X crashing, or logging out automatically when all windows are closed, and recovery is a bunch of unwelcome work and takes time.

I suspect (well, hope) that the people in the latter category wouldn't mind an always-on tab bar any more than the taskbar, whereas people in the former category likely would. And, as you point out, the document close behavior would match the SDI/MDI flavor advertised by the visible UI when displaying a single document. One alternative, if feasible, would be two back-end prefs and one gui pref toggling both, for simplicity in gui prefs and tweakability in the advanced config. --Tuukka 14:04, 7 April 2006 (PDT)


  • You have the choice, but no new preference is needed
  • The behavior is logically tied to either pseudo-MDI- or pseudo-SDI-mode (since Firefox is a hybrid, you can choose what side it should tend to)
  • You see what the current behavior is (visible or hidden tab bar)
  • The current default behavior remains unchanged


  • The difference between pseudo-MDI- and pseudo-SDI-mode isn't always obvious
  • You'll need an extension if you want to break this logical tie

It appears that this suggestion has now already been implemented, but... I'm not convinced that the reasoning is sound. Just because you choose to not hide the tab bar with only one tab left, it doesn't mean that you necessarily thinking in terms of Firefox as "tabbed browsing shell". Personally I think far more in terms of the "document viewer" model, but still choose not to hide the tab bar for entirely other reasons. So there really are two separate options that the user should be able to select independently.
To illustrate this, I will describe my own reasons for not hiding the tab bar, although this is probably just one example, and others may have other reasons. I have enabled the option to open tabs in the background, and I therefore reasonably expect that if I click to open a page in a new tab, that it will do so in a way which is minimally disruptive to my reading the current page. But if I hide the tab bar when there is only the one tab, then when I open the second tab, the text on the current page will all shift downwards in order to make space for the tab bar to appear. Because this behavior is disruptive to reading the current page, I instead always show the tab bar.
Alan I 11:08, 5 December 2007 (PST)


  • If the use-case was changed so that:
    • Ctrl+W will close the selected tab, as per currently, until only one tab is left in the current window.
    • If the number of open windows was >= 2, then pressing Ctrl-W would close the current window.
    • Otherwise, when only one tab in one window is left, Ctrl+W will blank the tab and clear session history (basically a quicker way of closing the tab and creating a new one).
... would this be a suitable compromise? That would allow the tabless users to close windows (apart from the very last one), and it would allow the single-window-mode users to not have their one window closed.
This is what gedit 2.10.5 does (except for blank document creation). The visible results of Ctrl-W being dependent in this way on whether there happen to be other gedit windows open somewhere is weird, imo. --Tuukka 16:58, 24 Jan 2006 (PST)

  • I have FF and would like to have tab bar auto hiding off but still have the window close when only 1 tab is left. Is this possible, or is some extension (presumably not yet created) needed? -Grick 13:59, 10 March 2007 (PST)
  • Count me as another who would like an option to set Ctrl-W to close the window with the last tab. --Crasch 01:54, 18 March 2007 (PDT)
  • Note that who uses keyboard shortcuts is an advanced user and is not "surprised" when the window disappears, because he knows, what is he doing. Who does not know that, uses mouse.
  • Seems a little daft to take this option away... I've been a avid user of ctrl+t/w for opening and closing tabs, and closing the last tab with ctrl+w too. Now I have to move to alt+F4 to shut Firefox down... Boo !!! --Jaspinall 15:31, 13th June 2007 (GMT+1)
  • Given the strength of opinion for both points of view, surely this is an obvious candidate for making an application preference? (Personally, I found the old behaviour far more intuitive. In terms of the application doing what I expect, it's +1 for IE7 from my perspective) --Weirdfish 09:37, 30th June 2007 (GMT+1)