What's the logic behind the "W" in Control+W to close a Tab in IE?

47

3

I like to make connections so I can remember keyboard shortcuts. I get Ctrl+T to open a new tab - but what's the logic behind Ctrl+W to close one?

Ann

Posted 2014-02-25T22:01:13.820

Reputation: 479

CTRL+W is the standard shortcut to closes a "window" (not a program! -- think MDI). – BrainSlugs83 – 2015-12-22T08:03:30.023

I have to say, it's proven to be a cataclysmic design at least for what seem practical purpose to me. To be quick when typing\editing, the Ctrl+arrow keys, Ctrl+backspace, and shift+arrow keys are vital.

Unfortunately, this means you'll generally hold the LEFT version of the Shift of Ctrl keys.

Then, if considering edits or rereading what I've typed, my hand will often linger in this area while determining the next use, because it's usually keys in that area. Or I'll use Ctrl+Right to jump through word-by-word as I read. – JeopardyTempest – 2016-06-26T00:16:04.160

However, if you look at the general vicinity of where the other fingers on the left hand sit when doing so... they're right in the vicinity of the W. Further exacerbated by the fact Ctrl+F is a common command when writing and Ctrl+T can be helpful to quickly look up information. Plus Ctrl+W is the find a word command in Linux' nano just to compound things. – JeopardyTempest – 2016-06-26T00:19:22.553

So, long-story-short... I've lost dozens of long worked out messages while editing on the fly. Perhaps I'm in a rare minority that edits this way (perhaps it's worth a try, it's the fastest, most precise way I've found to quickly shift\edit varying size blocks of texts, such as writing an essay or rewording a sentence)? Perhaps I desperately need to learn a better rest placement?

It may seem meaningless to most people. But imagine if quit were Ctrl+V, how often you'd accidentally close windows pasting. And Ctrl+W has no prompt. There's a reason delete and backspace are in remote spots! – JeopardyTempest – 2016-06-26T00:23:05.793

5May have to do with cmd-w to close windows on Macs from a few places I looked. – cutrightjm – 2014-02-25T22:07:16.267

Ctrl-C was already used for Copy? – Kevin Panko – 2014-02-25T22:13:19.187

7Ctrl+W has also been the shortcut to close the currently focused window on Windows for quite a long time. I would assume it was chosen because W -> Window and it's on the left side of the keyboard. – Der Hochstapler – 2014-02-25T22:23:58.017

18Ctrl+W also closes tabs on Firefox, Opera and Chrome – Ben Johnson mk2 – 2014-02-25T22:42:02.630

13It's there to troll people, mostly because Ctrl+Q quits the browser altogether for most modern browsers and Q and W are right next to each other on QWERTY layouts. – TC1 – 2014-02-26T13:44:43.887

1It's weird that Ctrl+W won't close a command prompt window, or a notepad window. Basically, it wasn't something native to Windows, ever. It was something they took from Apple, and then slapped on half-assed after it became the de facto standard. – jgritty – 2014-02-26T17:15:58.850

3As a long time user of an emacs-clone (lugaru epsilon, since version 3 or so) on DOS then Windows, the sudden introduction of that shortcut is annoying. On a traditional emacs binding, Ctrl+W is bound to kill-region, which is the most common command I use to cut selected text to the clipboard. When typing in a another context (like this comment right here) typing Ctrl+W has a very different and rather more catastrophic effect. Switching among several editor key bindings on the same machine is always a pain, but this one is relatively new compared to my history with epsilon. – RBerteig – 2014-02-26T22:37:41.123

1Ctrl+W is my most hated keyboard shortcut. For every time I've used it on purpose, I've hit it 10 times by accident. – wim – 2014-02-27T11:05:09.293

Answers

67

The W in Ctrl+W was chosen because previous to tabbed browsing being introduced (and currently, if you have tabbed browsing disabled) it's a shortcut to Close the Current Window.

Keyboard Shortcuts for Internet Explorer 6:

Close the current window - Ctrl+W

Keyboard Shortcuts for Internet Explorer 8:

Close current tab (or the current window if tabbed browsing is disabled) - Ctrl+W

Keyboard Shortcuts for Internet Explorer 11:

Close tab - Ctrl+W

Ƭᴇcʜιᴇ007

Posted 2014-02-25T22:01:13.820

Reputation: 103 763

1The other nasty thing is that Ctrl-w is used in applications like vim and several terminal emulators to delelete the last typed word. When typing in the browser it sometimes happens to me that I press Ctrl-w out of a habit, resulting in the current tab being closed. – Chiel ten Brinke – 2014-08-28T07:57:11.003

Yeah, but it's not like VIM is known for being intuitive on any level... -- Point being: "But that's not what it does in VIM" is a universally bad UX argument (kind of by definition). -- OTOH, "That's what it's done in almost every Windows program for the last 20 years" holds a little more water... – BrainSlugs83 – 2015-12-22T08:10:05.447

1didn't Office also use it to close the current document? – ratchet freak – 2014-02-26T09:23:46.180

10Note: it nearly universally closes the currently-active window across all programs. – Joseph Hansen – 2014-02-26T19:05:57.227

@rachet freak: Yes it was, it was a bit dangerous, since ctrl-q was left-align text (ctrl-e was center and ctrl-r was right-align). – Atheist – 2014-02-27T10:51:33.137

0

It was stolen from the Mac OS, which uses Command+W to close the current tab (for applications with tabs) or the current window. Note that Command+Q is used to quit the application, so Command+W, which is one key over, probably seemed like a good choice to close a window.

stackoverflowuser2010

Posted 2014-02-25T22:01:13.820

Reputation: 417

18I find this not plausible. Do you have any sources to support your words? – bazzilic – 2014-02-26T11:27:23.787

in firefox on Mac, command+w closes the tab, command+shift+w closes the window. something to note here, in alot of cases in Mac, keystrokes are not always consistent across applications - for instance home and end generally don't work unless the application specifically accommodates them. I don't believe you can 'steal' a keystroke. – jammypeach – 2014-02-26T11:54:03.670

5I can personally testify that Command-W was commonly used on Macs to close application/document windows 15-20 years ago ... which of course does not mean those conventions originated on the Mac. As a note, Ctrl-C for copy, Ctrl-X for cut, and Ctrl-V for paste also came from the Mac (although the Mac modifier was Command rather than Control); the dominant PC convention until roughly the mid-90's was Ctrl-Insert for copy, Shift-Insert for paste, and Shift-Insert for cut. – David – 2014-02-26T13:45:58.987

4... I remember reading that the choice of C/X/V for copy/cut/paste was deliberate. C for copy is an obvious mnemonic (at least if you're an English speaker), and X and V are adjacent to C (on QWERTY keyboards), plus X sort of resembles a pair of scissors. That would lend credence to the choice of W because of its proximity to Q. – David – 2014-02-26T13:53:45.990

1@David Also on QWERTY, "Undo" is to their left - Z – Izkata – 2014-02-26T14:25:40.010

@David: that rings a bell to me. I think they wanted to use P, but of course that was already taken tfor Print. – alexwlchan – 2014-02-26T14:29:49.193

6I can attest that command-w was used on macs to close the current window back before there was MS windows. "Stolen" might be a strong word, but certainly it's true that windows liberally borrowed from MacOS. – Dan Pritts – 2014-02-26T17:43:26.520

2@DanPritts Windows 1.0 was released in 1985, and at least the 1984 Macintosh Manual shows Close Window without shortcut (page 108). The earliest reference I found was a 1992 manual, nothing between those two though. Do you have relevant references? – Daniel Beck – 2014-02-26T18:53:19.573

4I would be very surprised if these do not both date back to earlier OSs. Anyway, using the same shortcut is not "stealing", it is providing a consistent user experience and I wish all OSs did more of that. – terdon – 2014-02-26T19:53:11.870

The use of Command-W in Finder and TeachText in System 4.2 released in October of 1987. The shortcut was not in System 4.1. Windows 2.0 was released in December of 1987. – Maxx Daymon – 2014-02-26T21:09:24.910

OK, my bad, i didn't realize windows 1.0 came that early. – Dan Pritts – 2014-02-26T23:05:17.850

Did Windows 1.0 have control-W as a close-window command? – stackoverflowuser2010 – 2014-02-26T23:35:34.463

1@stackoverflowuser2010 No, Windows 1.0 did not have Ctrl-W as a close window shortcut and, as of Windows 8, it still does not. Some specific applications have Ctrl-W set to close windows (or tabs), but many programs use Ctrl-W for other purposes. Cross-platform apps (Chrome, Firefox) and a few Windows apps (Explorer) bind Ctrl-W to close window, but it is not a standard for the platform. – Maxx Daymon – 2014-02-27T23:47:28.670

@David Ctrl-V goes back to the 1960s with QED and was called verbatim insert while the terms cut, copy, and paste were 'popularized' by Xerox around 1974. Search for Xerox Alto, Xerox Star, Gypsy, and Bravo. (Note, the Alto had a dedicated 'Copy' key) – Maxx Daymon – 2014-02-28T01:07:02.517

@MaxxDaymon That make sense since most of the concepts in the Mac UI came from Xerox PARC. – David – 2014-02-28T13:13:28.423

"Stolen". As in Macs lost that functionality at that moment? – GaTechThomas – 2014-03-04T22:53:53.590

-1

It was absolutely "stolen" or "borrowed" from Mac OS. Windows originally used Alt+F4 to close windows, but they realized that was a sub-optimal (read: dumb) choice.

W was chosen because of its close proximity to Q which was the obvious choice for a [Q]uit keyboard shortcut.

Apple was very keen on having every piece of software either internally or by a third party follow a set of human interface guidelines. Included in these guidelines was this, among many other things. Microsoft and Windows were much more open to allowing developers to do whatever they chose, and ignoring many conventions, certainly around how keyboard shortcuts worked. I certainly remember a lot of early windows software that had unique cut/copy/paste shortcuts.

For instance, even in Windows 7 Notepad doesn't close with Ctrl+W, you have to use Alt+F4, or Alt, then F, then X.

Another example is the command prompt. Even in 2014, you can't copy and paste like a normal human being, you have to first mark an area of text and then use the enter key to copy it. Likewise to paste, you right click, because why make everything the same? That's boring...

This is the oldest copy I could find of Apple's Human Interface Guidelines. On page 102 it says this:

The Close command closes the active window, which may be a document window, a modeless dialog box, a folder, or any other type of window. Clicking in a window’s close box provides a mouse-based method of closing windows. The user can also press Command-W to close windows.

While this copy of the HIG is from 1995, this convention was on the Mac before even this, perhaps as early as 1986.

There is even this internet gem talking about how Adobe products (on Windows) don't follow the convention used by Firefox:

I like the way Ctrl-W works in Firefox. It closes the current tab, but if there's only one tab open, it closes the whole Firefox window.

In Adobe products, Ctrl-W closes child windows but not the main program window.

Ctrl-W will close Explorer windows, but in many other programs, you have to use some other hotkey. I find myself trying to use Ctrl-W in other programs and getting frustrated when it doesn't work. I know about Alt-F4 but Ctrl-W is an easier combination to reach for.

Would it be possible to make a program that made Ctrl-W always work the way it does in Firefox? That is, no matter what program you were in, Ctrl-W would first close active child windows or tabs, then it would close the main program window. If the program only had one window, it would close that window.

Also, and this part would be optional, would it be possible for this program to:

-detect if the active program has ascribed a different use for Ctrl-W -if the active program uses Ctrl-W for something different, pop up a dialog box asking if you want to override the Ctrl-W behavior for this program from now on (in other words, this would allow the Universal Ctrl-W program to update a "override" and "exceptions" list)?

I hope this sounds useful to other people...

The answers suggesting AutoHotKey and the like are to a Mac user laughingly complex and unnecessary.

There's this as well

jgritty

Posted 2014-02-25T22:01:13.820

Reputation: 277

-1 - CTRL+W has been around in Windows apps for about 20 years -- it does something different than ALT+F4, as others have stated. -- CTRL+W should never close an application -- that would be incorrect behavior on Windows -- it should only close the active window. -- This is a low quality answer that misunderstand the difference between the two and reads like a fanboy rant. – BrainSlugs83 – 2015-12-22T08:12:42.643

16Alt+F4 is still the standard keyboard shortcut for closing a window on Windows (or rather, closing [the window of] the focused application), being associated with the "Close" item in the window menu common to most/all windowed applications on Windows (the one you get by left-clicking the far left region of the title bar, right-clicking anywhere in the title bar, or pressing Alt+Space). And even if the Windows console did have non-mouse copy-paste functionality, the bindings would be nonstandard as Ctrl+C already has historic meaning. – JAB – 2014-02-26T18:32:32.587

2

Found the Macintosh User's Guide for Macintosh PowerBook 160 and 180 computers from 1992 which shows the Close Window Cmd-W shortcut on PDF page 62 (labeled 46).

– Daniel Beck – 2014-02-26T18:47:31.593

10

CTRL-W is implemented at the application level, by the application authors (Microsoft or otherwise). Alt-F4 is "Quit program" on Windows (at the OS level). One is not a replacement for the other. Windows KB shortcuts: http://support.microsoft.com/kb/126449

– Ƭᴇcʜιᴇ007 – 2014-02-26T19:22:53.653

4Ctrl-C was already taken for the Command Prompt (it means break), so using the standard Ctrl-X/C/V would not work without breaking many command line programs. The Command Prompt is a special window (terminal emulator) and must take care to not hide keys that may be needed or responded to by the software running in the terminal, whether remote UNIX/VMS or local MS-DOS legacy apps. For example, if you are running a command line program that responds to Ctrl-W, having it close the Command Prompt would be infuriating. – Maxx Daymon – 2014-02-26T23:42:58.637

20-1 - this basically reads like a rant and then goes off into totally irrelevant territory for the question. The usage between applications is consistent by the way. Alt+F4 closes the whole application, Ctrl+W closes the window (or document) of the application. The only inconsistency is that some applications terminate after the last window is closed, some do not. As for if it is stolen from Apple or not; I suspect nobody will ever know for sure. – Mark Henderson – 2014-02-27T03:01:20.103

@MarkHenderson Wouldn't that be Ctrl+F4 then for consistency? IIRC Visual Studio tabs require that, trips me up every time. – Daniel Beck – 2014-02-27T17:47:22.890

2@DanielBeck On Windows, Ctrl-F4 closes tabs ("subwindows") in Chrome, IE, and Firefox. Alt-F4 closes the entire window (including all tabs) but if another window is open, it does not close that window. Ctrl-W is implemented as a compatibility equivalent to Ctrl-F4. – Maxx Daymon – 2014-02-27T23:37:32.233