Focus Management
Focus management moves the keyboard's active point after the page changes. It also returns focus when a temporary surface closes.
trigger -> place focus -> finish or close -> restore to a sensible target#edit-profile#display-nameEntertrigger -> place focus -> finish or close -> restore to a sensible targetA11YAnother example
A person opens Edit profile. Focus enters the dialog. After Save closes it, focus returns to Edit profile.
Main parts
- 01Triggering control
- 02Screen or DOM change
- 03Initial focus target
- 04Active element trace
- 05Close or completion event
- 06Return or fallback target
Use it when
Use it after opening or closing a dialog, deleting an item, or changing a route. Choose the next useful target first.
Do not use it when
Do not move focus for every small update. Unexpected jumps can make keyboard and screen-reader users lose their place.
Name used in code
trigger -> place focus -> finish or close -> restore to a sensible target Before you ship
Give assistive tools the control’s name (accessible name), purpose (role), value, and state. Check keyboard use, visible focus, target size, disabled and busy states, feedback, and recovery.
Outcome: Use Focus Management to solve this user need without losing the current context. User context: A person opens Edit profile. Focus enters the dialog. After Save closes it, focus returns to Edit profile. Recommended pattern: Focus Management. Why it fits: Use it after opening or closing a dialog, deleting an item, or changing a route. Choose the next useful target first. Do not use it when: Do not move focus for every small update. Unexpected jumps can make keyboard and screen-reader users lose their place. Product requirements: Define the default, loading, empty, error, success, and recovery states. Keep user input. Give clear feedback after every action. Accessibility and resilience: Use semantic HTML, full keyboard access, and visible focus. Make the layout work when zoomed and support reduced motion. Follow the project’s current rules. Do not add a new UI library unless the project already uses it. Acceptance criteria: The main task works with keyboard only and at 320px width. Focus and status changes are announced. Check loading, failure, retry, cancel, and reduced-motion paths. Evidence and limits (evidence boundary): It is official for that source. Other platforms or teams may use the term in another way. Unknowns to confirm: Product wording, data source, analytics events, supported devices and languages, and platform limits.
Check this request
Review the current use of Focus Management. Definition: Focus management moves the keyboard's active point after the page changes. It also returns focus when a temporary surface closes. Release checks: Give assistive tools the control’s name (accessible name), purpose (role), value, and state. Check keyboard use, visible focus, target size, disabled and busy states, feedback, and recovery. Before changing code, report the evidence you found, gaps, severity, and the smallest safe fix.