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

[EuiDatePicker] Fix year dropdown when using minDate or maxDate #5069

Merged
merged 12 commits into from
Aug 26, 2021

Conversation

thompsongl
Copy link
Contributor

@thompsongl thompsongl commented Aug 23, 2021

Summary

Closes #5058, closes #4219, and closes #2816, all of which were caused by a display: none; rule that accidentally targeted the wrong element when minDate and/or maxDate were configured.
The fix was to "remove" the elements that were hidden by custom styles, and also remove the custom styles that were having unintended consequences (i.e., hiding the min and max years in the dropdown).

See the comment about why I left some code in, but I'd be willing to delete the code now if preferred.

Checklist

  • Check against all themes for compatibility in both light and dark modes

- [ ] Checked in mobile
- [ ] Checked in Chrome, Safari, Edge, and Firefox
- [ ] Props have proper autodocs and playground toggles

- [ ] Checked Code Sandbox works for the any docs examples
- [ ] Added or updated jest tests

  • Checked for breaking changes and labeled appropriately
  • Checked for accessibility including keyboard-only and screenreader modes
  • A changelog entry exists and is marked appropriately

@thompsongl thompsongl changed the title [EuiDatePicker] Fix year dropdown when using minDate or `maxDate [EuiDatePicker] Fix year dropdown when using minDate or maxDate Aug 23, 2021
@thompsongl thompsongl requested a review from cchaos August 23, 2021 21:49
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5069/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Oh man, if I had known I could update the react-datepicker package in #5000 ... 😆

Whelp you uncovered a style change that I didn't afford for in the Amsterdam styles. Can you update the following styles:

.react-datepicker__year-dropdown-container>div:not([class*='read-view']),
.react-datepicker__month-dropdown {
-  height: 100%;
-  height: 250px;
+  max-height:  250px;
}

This will fix the height of the year dropdown when there are only a few options. And so may be a good case to add a specific example for?

And then I just found another stylistic issue for when a day is selected & disabled and in range & disabled.

Screen Shot 2021-08-23 at 19 12 52 PM

Which, btw, should the input be showing invalid when a date is selected outside of the allowed min/max?

@cchaos
Copy link
Contributor

cchaos commented Aug 24, 2021

I pushed you a fix for those style issues

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5069/

@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5069/

@thompsongl
Copy link
Contributor Author

should the input be showing invalid when a date is selected outside of the allowed min/max?

The error state is configurable by the consumer. In that example isInvalid={startDate > endDate} so it only cares about the one case.
I'll add a new example that shows configuring minDate, maxDate, and relevant isInvalid settings.

@thompsongl thompsongl requested a review from cchaos August 24, 2021 21:31
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5069/

@thompsongl thompsongl requested a review from cchaos August 25, 2021 20:09
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5069/

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

LGTM Functionally and stylistically! Thanks!

CHANGELOG.md Outdated Show resolved Hide resolved
@cchaos cchaos enabled auto-merge (squash) August 26, 2021 14:08
@kibanamachine
Copy link

Preview documentation changes for this PR: https://eui.elastic.co/pr_5069/

@cchaos cchaos merged commit e1c7821 into elastic:master Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants