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

fix: #4360 Cancel Event when clicked/MouseEnter on disabled months/quarters #4607

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

yuki0410-dev
Copy link
Contributor

@yuki0410-dev yuki0410-dev commented Mar 17, 2024

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

  • I have followed the contributing guidelines.
  • I have added sufficient test coverage for my changes.
  • I have formatted my code with Prettier and checked for linting issues with ESLint for code readability.

Sorry, something went wrong.

Copy link

@pullrequest pullrequest bot left a 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 not sent to the PullRequest network because the pull request is a draft.

Copy link

codecov bot commented Mar 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.96%. Comparing base (09198c9) to head (3fb8105).

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.
📢 Have feedback on the report? Share it here.

@yuki0410-dev yuki0410-dev force-pushed the fix/4360 branch 2 times, most recently from f4347ba to 5373595 Compare March 17, 2024 16:00
@yuki0410-dev yuki0410-dev marked this pull request as ready for review March 17, 2024 16:01
Copy link

@pullrequest pullrequest bot left a 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.

Copy link

@pullrequest pullrequest bot left a 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.

Copy link

@pullrequest pullrequest bot left a 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.

Image of Ryan Ryan


Reviewed with ❤️ by PullRequest

);
const labelDate = utils.setMonth(this.props.day, m);

if (utils.isMonthDisabled(labelDate, this.props)) {
Copy link

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

Image of Ryan Ryan

Copy link
Contributor Author

@yuki0410-dev yuki0410-dev Mar 18, 2024

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.

if (!this.isDisabled() && this.props.onClick) {

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?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, since the reported issue is about handling clicks, I'm still not quite following why we need to be dealing with handling mouse enter behavior as well in order to fix this.

Image of Ryan Ryan

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are both good points, I think it seems fine with all of that in mind.

Image of Ryan Ryan

Copy link

@pullrequest pullrequest bot left a 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. 🎉

Image of Graham C Graham C


Reviewed with ❤️ by PullRequest

Copy link

@pullrequest pullrequest bot left a 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:

Image of Graham C Graham C

Copy link

@pullrequest pullrequest bot left a 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:

Image of Graham C Graham C

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
… months/quarters
@martijnrusschen martijnrusschen merged commit 5261cbd into Hacker0x01:main Mar 19, 2024
6 checks passed
@yuki0410-dev yuki0410-dev deleted the fix/4360 branch March 19, 2024 10:23
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 this pull request may close these issues.

includeDates and showMonthYearPicker should not close the calendar when clicked on disabled months
2 participants