Opened 11 years ago

Closed 7 years ago

#4385 closed bug (notabug)

Slider: event slide callback returning false can lead to stuck range handles

Reported by: Cloudream Owned by:
Priority: minor Milestone: 1.9.1
Component: ui.slider Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:

Description

Using slide:function(e,ui){ return (ui.values[1] - ui.values[0] > 50); } can't enforce values.

see demo committed.

Change History (9)

comment:1 Changed 11 years ago by Cloudream

More problem:

  1. drag handler #0 to right, let values[0] = values[1] = 300.
  2. you can't drag handler #1 now.

http://jquery-ui.googlecode.com/svn/trunk/tests/visual/slider/slider_range_4385.html

comment:2 Changed 11 years ago by rdworth

Summary: simulating minRange shows "error" valuesSlider: event slide return false shows "error" values

comment:3 Changed 11 years ago by rdworth

Summary: Slider: event slide return false shows "error" valuesSlider: event slide callback returning false can lead to stuck range handles

The original issue for which the ticket was created is actually a bug in how the test was written. Fixed in r2348.

The other issue remains: by sometimes returning false in the slide event callback, you can get to a point where neither handle can be dragged.

comment:4 Changed 11 years ago by Scott González

Milestone: TBD1.8

comment:5 Changed 10 years ago by bkrausz

May be caused by Ticket #4751

comment:6 Changed 7 years ago by Scott González

Milestone: 1.9.01.11.0

comment:7 Changed 7 years ago by tj.vantoll

Status: newopen

This is still relevant in 1.9.

To recreate: http://jsfiddle.net/tj_vantoll/HBMug/.

  • Drag the left handle towards the right one.
  • Per the specified slide event the handles the sliders are prevented from getting within 50 of each other. However, frequently one handle gets "stuck" and you cannot move the handles closer together with the mouse (you still can with the keyboard).

comment:8 Changed 7 years ago by petersendidit

Milestone: 1.11.01.9.1

I don't know that this is a bug with jQuery UI slider. The slide event continues to fire even if false is returned to the previous slide event. This allows the user to be able to slide the handle backwards after the slide event returned false.

I think the problem is really with the code that decides if to return false or not. Handles are not dragged at a 1 point intervals. It depends on how fast the mouse moves. If the mouse moves really quick then the values can jump past the 50 point difference.

Example:
First slide event the values are [ 47, 100 ], set rangevalue = 53, return true
Second slide event values are [ 52, 100 ], don't set rangevalue, return false

This results in what looks like the values getting "stuck" but they really are not. You just stopped setting rangevalue to early.

Check out this example, the top slider has "fixed" logic to always make sure that the difference between the 2 handles is always stopped at 50 and the bottom is the original logic. http://jsfiddle.net/petersendidit/HBMug/6/

comment:9 Changed 7 years ago by petersendidit

Resolution: notabug
Status: openclosed
Note: See TracTickets for help on using tickets.