Ah, cool. I think breaking this up into two functions (one to grab focus - called repeatedly, one to register the callback - called once) would be the best solution, but doesn't have to happen now.