dgraham/delegated-events

The `on` function does not work with `focus`

AlanKrygowski opened this issue · 2 comments

The on function does not seem to trigger at all when fired for the focus event.
Here's an example of the issue:
https://codepen.io/aln447/pen/zYoEjab

The same listener works well for all the others i've tested including the focusin event.

The focus event is the only one I can use in my usecase, and it would be great if it was corrected.
Thanks

Hey @AlanKrygowski thanks for the issue!

The MDN docs allude to the problem here. The focus event does not bubble, so cannot have delegate listeners. It must be bound to directly. focusin does bubble, however.

The description of delegated events in this readme hints that it can only listen to bubbling events.

I'll close this, as there's nothing we can do to fix this. The browsers built in behaviour for the focus event (among others) is such that it cannot be delegated.

For the same reason the blur event also does not work. Just adding in case any body happens upon this.