Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Slider] When props.step is not 1, allow max tick to be props.max #1483

Open
adrienharnay opened this issue Feb 1, 2021 · 6 comments
Open
Labels

Comments

@adrienharnay
Copy link

What problem does this feature solve?

I'm using

<Slider min={1} max={13} step={2} />

and would like the max tick to be selectable.

What does the proposed API look like?

I don't know about the best prop name for this, but the prop could ensure min and max are in the ticks.

Thanks in advance!

@SevenOutman
Copy link
Member

Not quite understanding your question.

I'm passing the same props as you stated, and the "max tick" seems to match the max prop well.

image

What's the expected behavior in your case?

@adrienharnay
Copy link
Author

I am sorry, I meant max={14}. Please see sandbox: https://codesandbox.io/s/sweet-clarke-1cv5z?file=/src/App.js. Sorry for the typo. Here on the sandbox, you can see that 14 cannot be selected, the max being 13. I believe this is a bug.

@simonguo
Copy link
Member

This is actually a logic of data verification, not a bug.

(13-1)/2 = 6
(14-1)/2 = 6.5

If the value of min is 1, the value of max is 14, and the value of step is 2, then there are 6.5 optional values, and we think that 0.5 is an invalid value.

@simonguo
Copy link
Member

I refer to Slider of some other component libraries.
material-ui is an option that retains 0.5, while antd is not optional.

We will consider it in combination with practical usage scenarios.

@adrienharnay
Copy link
Author

Ok thank you!

@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants