focus/blur events are unusual in that they don't bubble but they spawn
focusin/focusout counterparts that do bubble. Calling the native method a second time in a row has no effect at all, unlike
.focus() doesn't get any of those three things right because it simply uses the
.trigger("focus") behavior which isn't appropriate. There are differences in other events but nothing quite so much as this.
wouldn't you break a large amount of existing user code?
At least for this case,
$el.focus() works perfectly when
$el.focus() does not, and it mirrors the event behavior you'd see in user input focusing. I think it would match what people already expect
If there were situations where people expected
$el.focus() programmatic behavior to be different than user input behavior (for example, handlers run even when re-focusing focused elements and a
focus event bubbles to document) then yep it would be a breaking change.
Let me drop in a fix to address this specific bug in 1.6.3 and we'll talk about the rest later. Unless you just want to use
$el.focus() for now.