- Open note browser with at least two notes
- In editor for note A, focus a field input that will trigger the
editor_did_unfocus_fieldfor some addon - Without clicking anywhere else click on note B
- In editor for note B, click somewhere else
- → Focus is lost in the field input that was previously focused, triggering the hook. The hook receives note B as the
notearg.

What I’d expect to happen
Nothing. After switching to note B, the field doesn’t appear focused so the hook triggering seems weird. Typing will not edit the field but clicking somewhere still triggers the hook, so the input appears to still be invisibly focused in some way.
I’d expect the editor_did_unfocus_field hook to be triggered only when there is clearly an input in focus, then it gets unfocused. In this case, the event is leaving one note editor and opening another which doesn’t look or feel like leaving one field input which is what the editor_did_unfocus_field feels like it should do.
This isn’t so bad when the the triggered addon code takes a fraction of a second to complete. In my addon, the hook triggers an AI API call that takes 3-5 seconds. It feels annoying because I was not intending to trigger it when switching notes and then I’m stucking waiting for it to finish.
The reason why this happens might be related to the other editor focusing bug, some focused flag getting left over when switching the note in the editor? Note editor jumps when previous focus was in HTML editor