Fix focus cycling with text boxes (Fixes #1454 and #1225)