Fix a bug where the text cursor would sometimes not be positioned correctly when an element receives focus.