Update input focus when visual focus changes using JavaScript