Focus on the input field when state is changed