Fixed arrow keys in text fields

Fixed a bug that prevented arrow keys from working properly when editing
text fields.