Bug fixes for text input defocusing