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

Call stopPropagation on nativeEvent on next and previous month click #10

Closed
iancmyers opened this issue Apr 6, 2015 · 1 comment · Fixed by #12
Closed

Call stopPropagation on nativeEvent on next and previous month click #10

iancmyers opened this issue Apr 6, 2015 · 1 comment · Fixed by #12

Comments

@iancmyers
Copy link
Contributor

In handleNextMonthClick and handlePrevMonthClick event propagation is not being stopped because stopPropagation is being called on the synthetic event, not on the native event.

https://github.com/gpbl/react-day-picker/blob/master/src/DayPicker.js#L58 and https://github.com/gpbl/react-day-picker/blob/master/src/DayPicker.js#L70 should be:

e.nativeEvent.stopPropagation();

Alternatively, you could pass the event to the onNextMonthClick callback (as you do with onDayClick) and let the component user decide whether to stop propagation or not. I'd be happy to PR either fix. Let me know which you prefer.

@gpbl
Copy link
Owner

gpbl commented Apr 7, 2015

Yeah definitely we should pass the event to the callback - could you send a PR?
Thanks

iancmyers added a commit to iancmyers/react-day-picker that referenced this issue Apr 7, 2015
Pass the SytheticEvent to the onPrevMonthClick callback and the
onNextMonthClick callback so that the developer can access it as
needed.

Updated the corresponding documentation in the README.

Fixes gpbl#10
@gpbl gpbl closed this as completed in #12 Apr 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants