ice icon indicating copy to clipboard operation
ice copied to clipboard

selection/caret events don't fire for keyboard events

Open benesch opened this issue 13 years ago • 1 comments

There are three selection/caret related events:

  • caretUpdated Fires on keyup, range updated, and mousedown, range not yet updated
  • caretPositioned Fires on arrow key keydown, range not yet updated
  • selectionChanged 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 updated
  • selectionPositioned Fires on arrow key keydown w/ arrow key and mousedown, range not yet updated

benesch avatar Mar 05 '12 02:03 benesch

@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.

delambo avatar Jun 01 '12 02:06 delambo