Fixed bug about mode change swallowing flash message and the focus bug where the input text
would get highlighted rather than the cursor being set to the end of the text.