Fix focus cycling with text boxes

This fixes the issue that the wrong text box is focused. I don't know why this fix works and it may not be the right approach but it works (at least in the cases where I tested it)...