Design and Layout:Controls:Keyboard

From KDE-HIG_Wiki


Keyboard Navigation

Keyboard navigation allows to navigate and activate widgets exclusively with the help of the keyboard. By using the Tab and Arrow keys, the user can move between widgets in a window or dialog that receive input focus. To activate a widget which has the input focus, the user typically pushes the Space bar or Return.

This type of keyboard navigation and activation may be supported by shortcuts, accelerators and access keys. Shortcuts provide a means to quickly activate widgets in an application window, but also to navigate between an application's windows or in the whole system.

Regarding keyboard navigation, there are several pitfalls that should be kept in mind:

  • Providing application-wide shortcuts may interfere with keyboard navigation:
    • Non-active tabs can not be reached when Arrow left and right are generally assigned to another functionality: When arrow left and right are generally assigned to the volume in a music player, he cannot use arrow left and right to switch between the playlist and the player tab.
  • On the other hand, binding shortcuts too strictly to a certain element may confuse users:
    • If a html browser provides a navigation panel on the left, the shortcut to activate access keys and other view-related shortcuts (e.g. Zoom) in the html page should also work when the focus is in the navigation panel.
  • Toolbars cannot be reached using the keyboard, so they do not function as a shortcut when navigating without a mouse.


Guidelines


Keyboard access

  • Make sure all widgets in your application are accessible with the keyboard.
  • Set the tab order to fit the user's sequence of actions.
  • Provide accelerator keys for all widgets of an application, including lists or tables (see Keyboard Accelerators).
  • Provide keyboard shortcuts for the most frequently used menu action (see Keyboard Shortcuts).


Focus

  • Set the initial keyboard focus into the active component, otherwise keyboard navigation is not possible.
  • The initial keyboard focus should be set to the widget which first needs to be operated. If the sequence of operation can not be determined, the one in the upper left corner (Roman system) should be chosen.
  • The tab sequence should make it easy to navigate between related widgets. Typically it leads from the upper left to the bottom right corner in Roman systems.
  • The automatic tab sequence assigned by Designer should be checked for reasonableness.
  • TODO: Where to set the input focus?


Keyboard navigation

  • Use the standard keys for navigating widgets in KDE (see Standard Keyboard Navigation).
  • Application shortcuts should not interfere with the standard keyboard navigation, especially Tab, Shift-Tab and Arrow Keys.
  • If application shortcuts make use of those standard keys the corresponding actions should still be available,
    • e.g. by providing the standard action only when the input focus is on the corresponding interface element (e.g. volume is not set with arrow left/right when focus is on the tab).
  • Important actions which are located in the toolbar should also be quickly accessible in context menus.


Implementation Suggestions

To assign accelerators to lists or tables, you have to link them with their label via Qt Designer's "Edit Buddy" function.


See Also


Related To

Keywords