Keyboard Text Selection

Pierre Igot complains about the behaviour of Mac OS X's keyboard text selection. After selecting text with the mouse and changing that selection by pressing ⇧-← or ⇧-→ on the keyboard, the selection continues to shrink or grow either on the left or the right edge, depending on whether you first hit the left or the right arrow.

This behaviour actually matches the HIG's recommendations. Since this is an "invisible" user interface, it's important to be consistent with other applications. So I don't recommend implementing different behaviours. However, I do think that the current behaviour is not particularly intuitive.

Igot thinks that it would be better to always shrink or grow on the side of the selection where you released the mouse button, i.e. when dragging from left to the right, the selection should always grow or shrink from the right edge. There are good reasons for this:

  1. It's always consistent and relies on highly conscious user behaviour (dragging the mouse) instead of less conscious behaviour (hitting a key on the keyboard). It's probably easier to remember where you ended your selection than which particular arrow key you hit next.
  2. The location of the selection's "growing point" is based on the actual action of making the selection, not on what you do after you've made the selection.
  3. The user's focus follows the mouse. After making a selection, the user's focus is where he or she dragged the mouse to. Thus, any user input should affect that area.
  4. It's easier to aim with your mouse when the mouse button is not pressed. Furthermore, if the user misses the beginning of the selection, he or she will likely abandon the selection process and start over. In other words, user intention is more likely to change the end of the selection (where users release the mouse) than the beginning of the selection, since the end of the selection is more likely to be off by a few characters.

Other operating systems avoid this ambiguity by showing the caret position even when a selection exists. This is a screenshot of Windows:

Text Selection in Windows

This removes Mac OS X's ambiguity and makes the arrow keys' behaviour obvious.

There is one problem with this: When users select non-editable text, the text insertion point is not shown, and changing the selection using the keyboard does not work.

Daring Fireball has more links on this issue.

If you require a short url to link to this article, please use

designed for use cover

But wait, there's more!

Want to read more like this? Buy my book's second edition! Designed for Use: Create Usable Interfaces for Applications and the Web is now available DRM-free directly from The Pragmatic Programmers. Or you can get it on Amazon, where it's also available in Chinese and Japanese.