-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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 #2419 breaking with altInput and altFormat Enabled #2662
Conversation
expect(fp._input.value).toBe("22 January 2020 03:04"); | ||
}); | ||
|
||
it("should trigger onChange only once", () => { |
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 test is for the issue mentioned here:
#2601 (comment)
@@ -817,6 +852,29 @@ describe("flatpickr", () => { | |||
expect(fp.currentYear).toBe(2016); | |||
}); | |||
|
|||
it("onKeyDown closes flatpickr on Enter when allowInput set to true", () => { |
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 test is to ensure that this fix is covered:
https://github.com/flatpickr/flatpickr/pull/2419/files#diff-a2a171449d862fe29692ce031981047d7ab755ae7f84c707aef80701b3ea0c80R1627
onChange: () => timesFired++, | ||
}); | ||
fp._input.focus(); | ||
document.body.focus(); | ||
simulate("blur", fp._input); |
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 needed to be changed, otherwise if I make an actual change onChange
won't be fired.
!isCalendarElem(e.relatedTarget as HTMLElement); | ||
!isInput && | ||
!isCalendarElement && | ||
!isCalendarElem(e.relatedTarget as HTMLElement); |
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.
Removing e.type === "blur"
since it's confusing.
We used to accept blur events in the documentClick()
, but we no longer after a7acd8f.
updateValue(); | ||
|
||
if (self._input.value !== valueFromInput) { | ||
if (self._input.value !== prevValue) { |
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.
These changes are the revert of #2419.
@chmln Could you review this? Looks like many people are having this issue. |
Hi, the behavior of 4.6.11 is now the same as 4.6.9, which was triggering an unexpected A reduced test case is available at https://jsfiddle.net/tagliala/bahnou4z/11/ Should I open a new issue? |
Yes please @tagliala |
[![WhiteSource Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [flatpickr](https://flatpickr.js.org) ([source](https://togithub.com/chmln/flatpickr)) | [`4.6.10` -> `4.6.11`](https://renovatebot.com/diffs/npm/flatpickr/4.6.10/4.6.11) | [![age](https://badges.renovateapi.com/packages/npm/flatpickr/4.6.11/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/flatpickr/4.6.11/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/flatpickr/4.6.11/compatibility-slim/4.6.10)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/flatpickr/4.6.11/confidence-slim/4.6.10)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>chmln/flatpickr</summary> ### [`v4.6.11`](https://togithub.com/chmln/flatpickr/releases/v4.6.11) [Compare Source](https://togithub.com/chmln/flatpickr/compare/v4.6.10...v4.6.11) There was a bug with time selection since so much stuff got merged in. New tests have been added to prevent this from happening again. #### What's Changed - Fix [#​2419](https://togithub.com/chmln/flatpickr/issues/2419) breaking with altInput and altFormat Enabled by [@​mshibuya](https://togithub.com/mshibuya) in [https://github.com/flatpickr/flatpickr/pull/2662](https://togithub.com/flatpickr/flatpickr/pull/2662) - Bug fix: error thrown and calendar UI broken by invalid input value when allowInput is true and allowInvalidPreload is true by [@​barszczmm](https://togithub.com/barszczmm) in [https://github.com/flatpickr/flatpickr/pull/2650](https://togithub.com/flatpickr/flatpickr/pull/2650) #### New Contributors - [@​barszczmm](https://togithub.com/barszczmm) made their first contribution in [https://github.com/flatpickr/flatpickr/pull/2650](https://togithub.com/flatpickr/flatpickr/pull/2650) **Full Changelog**: flatpickr/flatpickr@v4.6.10...v4.6.11 </details> --- ### Configuration 📅 **Schedule**: "every weekend" (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Never, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, click this checkbox. --- This PR has been generated by [WhiteSource Renovate](https://renovate.whitesourcesoftware.com). View repository job log [here](https://app.renovatebot.com/dashboard#github/carbon-design-system/carbon-for-ibm-dotcom).
As I noted in #2653 (comment), #2419 didn't handle altFormat properly and caused the issue #2653 and #2660.
This PR fixes the issue, by removing most of the fix from #2419. That's because It turned out that the fix made by #2541 and #2601 also addresses the issue #2419 was trying to solve.