Fixed selectFocus logic