Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#7933 closed enhancement (wontfix)

slider: snapping of value to floor/ceil rather than always nearest step

Reported by: AlanKrueger Owned by:
Priority: minor Milestone: 1.9.0
Component: ui.slider Version: git (not yet released)
Keywords: Cc:
Blocked by: Blocking:

Description

Should there be an option that allows snapping a value to floor or ceil rather than whichever is closer?

For instance, say you have a text input and slider tied together, representing a maximum bid, with the slider set to $10 steps. If the user enters $55, this would result in the slider jumping to $60. This is greater than the maximum amount the user just entered, and seems like incorrect behavior.

If, however, there was an option to specify, say, stepType="floor" (rather than hypothetical default, stepType="round"), then the control would snap to the nearest lower value instead of the closest of the upper and lower.

Change History (5)

comment:1 Changed 9 years ago by Scott González

Component: ui.coreui.slider
Resolution: wontfix
Status: newclosed

This shouldn't be in the plugin. If you want that behavior, you should adjust the value before setting the slider value.

comment:2 in reply to:  1 Changed 9 years ago by AlanKrueger

Replying to scott.gonzalez:

This shouldn't be in the plugin. If you want that behavior, you should adjust the value before setting the slider value.

So...the caller should replicate the snap-calculation logic themselves, external to the plugin, then tweak it?

Can we avoid tagging this "wontfix" until you see the patch I was putting together on github?

comment:3 Changed 9 years ago by Scott González

Not unless your patch doesn't add an option to spinner.

comment:4 in reply to:  3 Changed 9 years ago by AlanKrueger

Can you elaborate a bit on your reasons for that response?

comment:5 Changed 9 years ago by Scott González

It's unnecessary to support rounding types for slider to work properly and rounding to the nearest valid step follows HTML 5. Since the current implementation satisfies the overwhelming majority of users and does not restrict what you're asking for, we should not be adding an option.

Note: See TracTickets for help on using tickets.