FRM-013 Receiving focus never sends a form, opens a page, a window or a dialog that takes focus, or moves focus on
- Level
- Rule
- Verdict
- Requirement
- Area
- Forms
- Status
- proposed, version 1.0.0
Rule
When a control receives focus, by Tab, a click or a script, that alone never sends a form, opens a page, a window or a dialog that takes focus, or moves focus to another control. A notice before the control does not change this. Content that appears beside the control and leaves focus in it is allowed.
Examples
Live examples built with Justified's components. Try them with the mouse, the keyboard or a screen reader.
Do: Focus shows a hint, a button opens the filters
Page: Find a clinic
Don't: Reaching the field opens the filters
Page: Find a clinic
Reaching this field opens the filters.
Opened by focus alone: 0
Do: Tab passes through the clinics
Page: Clinics near you
Don't: Tabbing to a clinic opens it
Page: Clinics near you
Do: A field nobody should visit is text
Page: Book an appointment
Patient number: P-20931
Don't: A field forwards focus to the next one
Page: Book an appointment
Focus passed on (once, then Reset arms it again): 0
Why
Keyboard users move through a page by giving each control focus in turn. If arriving on a control sets something off, they cannot pass it: the page sends or changes under them, or focus is thrown somewhere else before they can act. Screen reader users meet the same wall, and anyone who clicks into a field to read it can be sent away by mistake. WCAG 2.2, 3.2.1 On Focus requires that a component receiving focus does not start a change of context. Unlike 3.2.2 On Input, which FRM-012a covers, it has no exception for people who were told beforehand. The Working Group's way to pass is to let changes of context start only when people activate something, such as a link or a button (G107). It lists as a failure a script that takes focus away as soon as a control gets it (F55), which also breaks 2.1.1 Keyboard. That is why 2.1.1 is listed as support. Showing something on focus that leaves focus where it was, such as a tooltip, a hint or a list of suggestions, is a change of content and outside the criterion.
Do
- In a clinic's booking form, the field Appointment date opens its calendar
Popoverwhen the person presses the calendar button next to it or presses Enter or Space on that button. Tab from Appointment date goes on to the calendar button and then to Reason for visit. - If the calendar opens when the date field gets focus, keep focus in the field with
onOpenAutoFocus={(e) => e.preventDefault()}, and let the down arrow or the calendar button move into it. The calendar stays open while focus is in the field or inside the calendar, and closes when focus goes anywhere else or the person presses Escape, as TXT-002a asks for content shown on focus. - The icon next to Reason for visit shows the tooltip "Seen only by your doctor" on focus and on hover, and focus stays on the icon. TXT-002a and TXT-002b set how that tooltip behaves.
- The combobox Doctor opens its list of names when it gets focus, with focus still in the input. Nothing is chosen until the person picks a name with Enter or a click, and Escape closes the list, as TXT-002a asks.
- In the
DropdownMenuBooking actions, with Move appointment and Print confirmation, arrow keys move the highlight without running anything. Only Enter, Space or a click runs an item. In aSelectsuch as Clinic, Enter only records the value, as FRM-012b asks. Radix behaves this way by default; keep customonFocusoronPointerMovehandlers on items from changing that. - Our own advice: show a value the clinic fills in, such as Patient number, as plain text, or as a
readOnlyinput that keeps its place in the tab order. Many screen reader users expect to reach and read such a field, so do not take it out of the tab order just to hide it. Either way focus stays where it lands and needs no forwarding. - Every control stays reachable and visibly focused by keyboard, as KBD-001 asks.
Don't
- Open the calendar
PopoverfromonFocuson Appointment date and let Radix move focus into the calendar, so Tab never gets past the field. - Open a
Sheetwith search filters when the field Search clinics is tabbed into, and let it take focus, so a keyboard user is pulled into the panel each time they reach the field. The same goes for aHoverCardorPopoverwith the doctor's profile that opens when a doctor's name gets focus and moves focus into it. - Call
router.pushfromonFocuson a clinic card in a list, so tabbing through the list opens the first clinic. - Send the search Find a clinic when the field is tabbed into, or start the next step when its first field gets focus.
- Forward focus from one control to the next in an
onFocushandler, or callblur()in one so the control drops focus as soon as it gets it. The Working Group lists that second pattern as a failure. - Our own advice, beyond what 3.2.1 covers: do not move focus into a menu's panel when the pointer merely hovers its trigger. Hover gives no focus, and a script that adds it surprises keyboard and screen reader users. Inside a menu that is already open, Radix moving focus to the item under the pointer is fine; leave that default alone.
- Write "Reaching this field opens the filters" above Search clinics and keep the
Sheetthat takes focus. No notice makes a change on focus acceptable.
Exceptions
- Activation. A click or a press of Enter or Space on a button or a link activates it, and may open a page or a dialog. That is not focus alone. Where focus goes when a dialog opens and closes is DLG-006, and the order focus follows is LAY-002.
- Focus set after the person acted. A page or dialog that opens with focus in its first field, because the person pressed something to get there, is outside this rule.
- The focused item disappears. When the item with focus is removed, focus has to move somewhere. Where focus goes then is DLG-006 when it happens behind a dialog, and STA-002a when a list is emptied; elsewhere this rule does not decide it.
- One control that grows. A search icon that opens into its own field and puts focus in it is perceived as one control. This rule neither forbids nor recommends it.
- Changes of value. A combobox that chooses the highlighted option when it loses focus has changed a value, and that is FRM-012a.
Verdict
Requirement. Only the judges decide; the expert witnesses are shown but do not vote. How verdicts work
| Source | Role | Stance | Page |
|---|---|---|---|
| WCAG 2.2 | Law | Requires | 3.2.1 On Focus |
| WCAG 2.2 | Law | Supports | 2.1.1 Keyboard |
| Material Design | Judge | No position | |
| Apple Human Interface Guidelines | Judge | Supports | Focus and selection (ipados, macos, tvos, visionos; not ios or watchos; no web guidance) |
| Carbon Design System | Judge | No position | |
| GOV.UK Design System | Expert witness | No position | |
| Nielsen Norman Group | Expert witness | No position |
Each stance links to the page it rests on, read on the date in the source register. This page never repeats what a source says; read the source itself.
History
- Version 1.0.0, : First version.
Last checked against the other rules for conflicts on .
More in Forms: 15 rules and 12 guidelines · All rules
Justified is an independent project. It is not affiliated with, sponsored or endorsed by the organisations whose guidance it cites. Read the full statement.
Apple is a trademark of Apple Inc., registered in the U.S. and other countries and regions.