keyboard focus

The single element on the page that currently receives keyboard input, such as the text box you are typing into.

In more detail

Users move focus with the Tab key and code moves it with element.focus(). Good interfaces move focus predictably, trap it inside open dialogs and return it to the triggering button when a dialog closes.

Example

inputRef.current?.focus() focuses an input from a React event handler.

Related terms

Taught in

References