Changes between Initial Version and Version 2 of Ticket #9531


Ignore:
Timestamp:
Jul 16, 2009, 6:50:28 PM (12 years ago)
Author:
bill
Comment:

Talked to Doug about this.

When dragging the slider handle with intermediateChanges=false, an onChange event only occurs at the end of the drag operation, on mouse up, not on mouse move.

So, we can see the desire to have an equivalent way to get that effect when controlling the slider with the keyboard, or when pressing the up/down arrow icons.

However, rather than using a timer, it seems like onChange should only fire on key-up (when controlling via keyboard) or mouse-up (when pressing the arrow icons). That seems analogous to the way dragging the handle works (where onChange() fires on mouse up). It probably amounts to more-or-less the same behavior from the user's perspective, since users are unlikely (or perhaps incapable) of pressing a key twice in 200ms anyway.

On a semi-related note, we also talked about collapsing multiple onChange() notifications that occur very close together to prevent browser overload. This would be done just by deferring onChange notifications w/a setTimeout() of 0ms, and then collapsing multiple onChange notifications if they occur before the browser fires that setTimouet(). That seems like a reasonable change to me too, but unrelated to this discussion as it would probably only take effect when intermediateChanges=true.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #9531

    • Property Owner set to Douglas Hays
    • Property Summary changed from [cla][patch] HorizontalSlider fires onChange for every arrow key increment/decrement to [patch] [cla] HorizontalSlider fires onChange for every arrow key increment/decrement
    • Property Milestone changed from tbd to 1.4
  • Ticket #9531 – Description

    initial v2  
    1 If I focus the slider handle in a HorizontalSlider and use the arrow keys to increment or decrement the slider, an `onChange` event is fired every time I press or hold the arrow key. IMO this causes the `onChange` to be fired way too often.
     1If I focus the slider handle in a !HorizontalSlider and use the arrow keys to increment or decrement the slider, an `onChange` event is fired every time I press or hold the arrow key. IMO this causes the `onChange` to be fired way too often.
    22
    33I've attached a patch that ensures `onChange` fires only if there has been no new arrow key event in the past 200ms. `intermediateChanges` can still override this behaviour.