Skip to content

Conversation

g4rry420
Copy link
Contributor

@g4rry420 g4rry420 commented Oct 16, 2021

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

Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
Copy link
Collaborator

@jcfilben jcfilben left a 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

@jcfilben jcfilben added the PRty Biweekly PR reviews by grommet team with hoping of closing such PRs label Oct 19, 2021
@jcfilben
Copy link
Collaborator

Looks like the snapshots just need to be updated. Run yarn test -u to update them.

Signed-off-by: GurkiranSingh <gurkiransinghk@gmail.com>
const handleMouseOver = () => {
const x = window.scrollX;
const y = window.scrollY;
window.onscroll = () => window.scrollTo(x, y);
Copy link
Contributor

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.

g4rry420 and others added 2 commits October 21, 2021 13:18
@ericsoderberghp ericsoderberghp merged commit e7d6ce9 into grommet:master Oct 21, 2021
@g4rry420 g4rry420 deleted the wheel_control_rangeInput branch October 22, 2021 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PRty Biweekly PR reviews by grommet team with hoping of closing such PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat] Mouse Wheel to control RangeInput Value
4 participants