I've tested defer and it does not reliably set the focus. So I reused timeout like it was below in the code (so now it's consistent).