initial focus
The element that receives focus when an overlay opens.
In more detail
Usually it is the first field or the primary control. In an alert dialog for a destructive action it should be the safest choice, such as Cancel, so an accidental Enter does not delete anything.
Related terms
- alertdialog — The ARIA role for a modal dialog that interrupts the user with an urgent message needing a response, such as confirming a deletion.
- focus trap — Code that keeps keyboard focus inside a container, such as an open modal, wrapping from the last element back to the first.
- modal dialog — A window laid over the page that users must deal with before returning to the page beneath, with role="dialog" and aria-modal="true".
Taught in
- Focus Management: Trapping, Restoration & Focus Rings — Design Systems & Component Engineering
- Modal Dialogs & Alert Dialogs: Accessible Overlay Patterns — Design Systems & Component Engineering