Skip to content
Accessibility·Intermediate·Coding·1 min read

When should code move focus?

Short interview answer

Only for meaningful context changes or recovery, such as opening a dialog, focusing an invalid field after submission, or restoring the trigger. Moving focus on ordinary rerenders disorients users.

Key takeaway

Explain the underlying mental model clearly, then support it with a concrete example and its trade-offs.

← Back to Keyboard and focus management

Related questions