Opened 4 years ago

Closed 3 years ago

Last modified 2 years ago

#9376 closed bug (fixed)

Slider value can be set greater than value of 'max' option

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

Description

Slider value can be set greater than value of 'max' option

Example on jsfiddle: http://jsfiddle.net/Bacher/6sdHc/

In this case, I can set value 100.

Change History (12)

comment:1 Changed 4 years ago by tj.vantoll

Behavior still occurs on 1.10.3: http://jsfiddle.net/tj_vantoll/TYm77/.

I have mixed feelings about this, technically what is being passed in is invalid because the attributes don't line up. min is 1, max is 99, and step is 3. If you change the min or max to correctly be multiples of 3 (the step value), this works fine.

That being said *maybe* we should support this because I could see it being a bit confusing.

comment:2 Changed 4 years ago by dekajp

Please have a look at this fix. I added a Slider.html in tests/Visual and modified jquery.ui.slider.js

I am sorry i missed the commit message style {WHAT} .

https://github.com/dekajp/jquery-ui/commit/f6efec156ca716e543b377572737ee990a09ce28

https://github.com/dekajp/jquery-ui/commit/2e05f3bcda3019a8483e298d67c41812475aa3f1

comment:3 Changed 4 years ago by Bacher

Good Fix. Thank you.

comment:4 in reply to:  2 Changed 4 years ago by tj.vantoll

Replying to dekajp:

Please have a look at this fix. I added a Slider.html in tests/Visual and modified jquery.ui.slider.js

I am sorry i missed the commit message style {WHAT} .

https://github.com/dekajp/jquery-ui/commit/f6efec156ca716e543b377572737ee990a09ce28

https://github.com/dekajp/jquery-ui/commit/2e05f3bcda3019a8483e298d67c41812475aa3f1

Hi @dekajp,

If you are interested in contributing a change please submit it as a pull request. Also we no longer maintain the visual tests and we'll want a unit test for this change.

Thanks.

comment:5 Changed 4 years ago by dekajp

@tj Sure , i will update my code and submit a pull request. Thank you for quick feedback !!!

comment:6 Changed 4 years ago by dekajp

@tj , I have submitted a pull request. https://github.com/jquery/jquery-ui/pull/1009

Looks like my commit history on my master is not very clean . I do not know if - this is a problem ? Let me know if you want me to rebase and clean my commit history. I am very new to Github :(

comment:7 Changed 4 years ago by petersendidit

New pull request that should resolve this problem: https://github.com/jquery/jquery-ui/pull/1030

comment:8 Changed 3 years ago by Jörn Zaefferer

Status: newopen

comment:9 Changed 3 years ago by Jyoti Deka

Resolution: fixed
Status: openclosed

Slider: Don't allow a slider's value to exceed its max

Fixes #9376 Closes gh-1016

Changeset: 6833a3169775d4c15dd5e68c96bc63ad0187035e

comment:10 Changed 3 years ago by tj.vantoll

Milestone: none1.11.2

comment:11 Changed 2 years ago by edimov

This fix has caused another issue though. Concerning slider with (float) step value. Example, slider with min=1, max=10, step=1 works great, however slider with min=1, max=2.5, step=0.01 never reaches 2.5 value.

Fiddle:

http://jsfiddle.net/edimov/ku7mL577/14/

Quite nasty, as there is no consistency to incorporate some universal logic to fix with a workaround.

comment:12 Changed 2 years ago by Scott González

That's being tracked in #10721.

Note: See TracTickets for help on using tickets.