Focus (computing)

In a computing graphical user interface (GUI), a component has focus when it is selected to receive input from the user by an event such as a mouse button click or keypress.[1] Moving the focus away from a specific user interface element is known as a blur event in relation to this element.[2] Typically, the focus is withdrawn from an element by giving another element the focus. This means that focus and blur events are virtually simultaneous in relation to different user interface elements, one that becomes focused and one that is "blurred" (in the computing, not visual, sense).

The concept is similar to a cursor in a text-based environment. However, when considering a graphical interface, there is also a mouse pointer involved. Moving the mouse will typically move the mouse pointer without changing the focus. The focus can usually be changed by clicking on a component that can receive focus with the mouse. Many desktops also allow the focus to be changed with the keyboard. By convention, the Tab ↹ key is used to move the focus to the next focusable component and ⇧ Shift+Tab ↹ to the previous one. When graphical interfaces were first introduced, many computers did not have mice, so this alternative was necessary. This feature makes it easier for people unable to use a mouse to use the user interface. In certain circumstances the arrow keys can be used to change focus.

  1. ^ "Managing UI Component Focus - Concept of Focus". Enlightenment. Retrieved 4 June 2023.
  2. ^ Garg, Naman (12 October 2018). "Javascript Window Blur() and Window Focus() Method". GeeksforGeeks. Retrieved 4 June 2023.