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 #2419 breaking with altInput and altFormat Enabled #2662

Merged
merged 1 commit into from
Mar 12, 2022

Conversation

mshibuya
Copy link
Contributor

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.

expect(fp._input.value).toBe("22 January 2020 03:04");
});

it("should trigger onChange only once", () => {
Copy link
Contributor Author

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", () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

onChange: () => timesFired++,
});
fp._input.focus();
document.body.focus();
simulate("blur", fp._input);
Copy link
Contributor Author

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);
Copy link
Contributor Author

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) {
Copy link
Contributor Author

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.

@mshibuya
Copy link
Contributor Author

@chmln Could you review this? Looks like many people are having this issue.

@chmln chmln merged commit da33a61 into flatpickr:master Mar 12, 2022
@tagliala
Copy link

Hi,

the behavior of 4.6.11 is now the same as 4.6.9, which was triggering an unexpected change event when the field value did not change

A reduced test case is available at https://jsfiddle.net/tagliala/bahnou4z/11/

Should I open a new issue?

@chmln
Copy link
Member

chmln commented Mar 15, 2022

Yes please @tagliala
It's great you got a reduced test case

kodiakhq bot referenced this pull request in carbon-design-system/carbon-for-ibm-dotcom Mar 21, 2022
[![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 [#&#8203;2419](https://togithub.com/chmln/flatpickr/issues/2419) breaking with altInput and altFormat Enabled by [@&#8203;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 [@&#8203;barszczmm](https://togithub.com/barszczmm) in [https://github.com/flatpickr/flatpickr/pull/2650](https://togithub.com/flatpickr/flatpickr/pull/2650)

#### New Contributors

-   [@&#8203;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).
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.

3 participants