-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
fix: #4360 Cancel Event when clicked/MouseEnter on disabled months/quarters #4607
Conversation
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.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4607 +/- ##
==========================================
+ Coverage 96.94% 96.96% +0.01%
==========================================
Files 28 28
Lines 2589 2601 +12
Branches 1091 1095 +4
==========================================
+ Hits 2510 2522 +12
Misses 79 79 ☔ View full report in Codecov by Sentry. |
f4347ba
to
5373595
Compare
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 pull request was sent to the PullRequest network.
@yuki0410-dev you can click here to see the review status or cancel the code review job.
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.
PullRequest Breakdown
Reviewable lines of change
+ 68
- 14
51% JavaScript
49% JavaScript (tests)
Type of change
Fix - These changes are likely to be fixing a bug or issue.
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.
As mentioned, this PR is fixing issue number #4360, which reports a subpar UX when clicking on disabled months. The desired behavior is instead to leave the calendar open.
I had one question below about some of the implementation. But otherwise this change seems fine to me.
Reviewed with ❤️ by PullRequest
); | ||
const labelDate = utils.setMonth(this.props.day, m); | ||
|
||
if (utils.isMonthDisabled(labelDate, this.props)) { |
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.
Are we sure there are no other scenarios where we would not want to disable the mouse enter event for disabled months/quarters?
I can understand the click handlers, but I wonder if we're limiting behavior or potential customization by doing this.
Even though the issue expects all events should be disabled, I'm not sure if that's the best idea unless it's also producing the reported issue. IT seems that just taking care of the click handlers should resolve it.
◽ Clarify Intent
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.
Thank you for the review.
This behavior is in reference to the processing of clicking on an invalid date in the case of the datepicker.
Line 84 in 87a9835
if (!this.isDisabled() && this.props.onClick) { |
Line 90 in 87a9835
if (!this.isDisabled() && this.props.onMouseEnter) { |
So far, no issues seem to have been created regarding the date behavior, so I think it is safe to assume that the policy is to match the behavior.
What are your thoughts on this?
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.
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.
I believe the processing of onMouseEnter is probably a consideration for range selection.
I understand about the loss of customizability, but this is also true for day.jsx, so I will stop at this PR until we can align the behavior of day.jsx and month.jsx.
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.
for sake of consistency, I think you're doing the right thing by aligning the behaviour with the day.jsx
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.
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.
I don't have anything further to add beyond the notes already left by Ryan. 🎉
Reviewed with ❤️ by PullRequest
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.
PullRequest reviewed the updates made to #4607 since our last review was posted. This includes comments that have been posted by non-PullRequest reviewers. No further issues were found.
Reviewed by:
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.
PullRequest reviewed the updates made to #4607 since our last review was posted. This includes comments that have been posted by non-PullRequest reviewers. No further issues were found.
Reviewed by:
… months/quarters
Description
Linked issue: close #4360
Problem
See issue #4360
Changes
Fix click/mouseEnter Event Handler iin months/quarters to determine if it is disabled or not.
Screenshots
To reviewers
Contribution checklist