selection/caret events don't fire for keyboard events
benesch opened this issue · comments
There are three selection/caret related events:
caretUpdated
Fires on keyup, range updated, and mousedown, range not yet updatedcaretPositioned
Fires on arrow key keydown, range not yet updatedselectionChanged
Fires on mouseup, range updated
Problem: selectionChanged
doesn't currently fire for keyboard events, and caretUpdated
fires for a mousedown
before the selection updates. I'm currently listening to both caretUpdated
and selectionChanged
, which results in some extraneous calls to the event handler on mousedown
before the selection's actually changed.
Am I missing the original design philosophy? I think you could consolidate nicely like so:
selectionUpdated
Fires on keyup and mouseup, range updatedselectionPositioned
Fires on arrow key keydown w/ arrow key and mousedown, range not yet updated
@primatology - We cut out a lot of plugins and have refactored since, so some of the old plugin events may not be functioning properly. I've been meaning to write some unit tests for this and a lot more.
I like your proposal - it's clean, and since no plugins are listening to the other events we could get this in without trouble. I can't get to this right now but would love some help from you or anyone that wants to take a stab at this.