From what I gather, jQuery’s focus() gets called before the element is focused. I believe this is so because the element’s border is different when focused, and when I measure it I get the unfocused border size.
Is there a way to run code right after the element gets focus?
You could run your code in a timeout handler after a tiny delay.