Interview practice question
Focusing an input when a modal opens
Frontend Engineering · React · Beginner
How would you automatically focus an input when a modal opens?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- useRef on input.
- Focus in useEffect after open.
- autoFocus attribute option.
- Return focus on close.
- Accessible dialog behaviour.
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.