-
Notifications
You must be signed in to change notification settings - Fork 1k
Mouse Wheel to control RangeInput Value #5693
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
Mouse Wheel to control RangeInput Value #5693
Conversation
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Co-authored-by: Matthew Glissmann <mdglissmann@gmail.com>
Looks like the snapshots just need to be updated. Run |
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
const handleMouseOver = () => { | ||
const x = window.scrollX; | ||
const y = window.scrollY; | ||
window.onscroll = () => window.scrollTo(x, y); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't feel like the right React way to do things. If something else has already hooked into window.onscroll
? Instead, I think we should save the window.scrollX
and window.scrollY
into a state variable and then use an effect hook to add and remove the event listener via addEventListener
.
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
Signed-off-by: GurkiranSingh gurkiransinghk@gmail.com
What does this PR do?
Mouse wheel to control RangeInput value
Where should the reviewer start?
components => RangeInput
What testing has been done on this PR?
Pre-written tests are passing successfully.
How should this be manually tested?
Using storybook, hover over the RangeInput and using mouse wheel to control the value.
Any background context you want to provide?
What are the relevant issues?
Closes #5664
Screenshots (if appropriate)
Do the grommet docs need to be updated?
No
Should this PR be mentioned in the release notes?
Is this change backwards compatible or is it a breaking change?
Backwards Compatible