Skip to content

Commit 48a45d1

Browse files
authored
fix: remove stale flatpickr DatePicker workarounds (#22004)
1 parent 4065cda commit 48a45d1

3 files changed

Lines changed: 2 additions & 28 deletions

File tree

packages/react/src/components/DatePicker/plugins/fixEventsPlugin.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -90,17 +90,6 @@ const fixEventsPlugin: FixEventsPlugin = (config) => (fp) => {
9090
fp.close();
9191
});
9292
}
93-
} else if (
94-
match(event, keys.ArrowLeft) ||
95-
match(event, keys.ArrowRight)
96-
) {
97-
// Prevents Flatpickr code from canceling the event if left/right arrow keys are hit on `<input>`,
98-
// so user can move the keyboard cursor for editing dates
99-
// Workaround for: https://github.com/flatpickr/flatpickr/issues/1943
100-
//
101-
// TODO: https://github.com/flatpickr/flatpickr/issues/1943 has been
102-
// addressed. Can the workaround be deleted?
103-
event.stopPropagation();
10493
} else if (match(event, keys.ArrowDown)) {
10594
event.preventDefault();
10695
fp.open();

packages/web-components/src/components/date-picker/fix-events-plugin.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,6 @@ export default (config: DatePickerFixEventsPluginConfig): Plugin =>
6767
);
6868
event.stopPropagation();
6969
break;
70-
case 'ArrowLeft':
71-
case 'Left':
72-
case 'ArrowRight':
73-
case 'Right':
74-
// Prevents Flatpickr code from canceling the event if left/right arrow keys are hit on `<input>`,
75-
// so user can move the keyboard cursor for editing dates
76-
// Workaround for: https://github.com/flatpickr/flatpickr/issues/1943
77-
event.stopPropagation();
78-
break;
7970
default:
8071
break;
8172
}

packages/web-components/src/components/date-picker/range-plugin.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,9 @@ export interface ExtendedFlatpickrInstanceRangePlugin
3333
* @returns
3434
* An extension of Flatpickr `rangePlugin` that does the following:
3535
*
36-
* Better ensures the calendar dropdown is always aligned to the `<input>` for the starting date.
36+
* Positions the calendar dropdown relative to the `<input>` for the starting date.
3737
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1944
38-
* Disables the logic in Flatpickr `rangePlugin` that calculates the new range with the old selected date
39-
* when user selects a date from calendar dropdown.
40-
* We'd like to reset the selection when user re-opens calendar dropdown and re-selects a date.
41-
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1958
42-
* Disables the logic in Flatpickr `rangePlugin` that closes the calendar dropdown
43-
* when it's launched from the `<input>` for the end date and user selects a date.
44-
* Workaround for: https://github.com/flatpickr/flatpickr/issues/1958
38+
* Commits manual range input values on blur for both inputs when `allowInput` is enabled.
4539
* Ensures that the `<input>` in shadow DOM is treated as part of Flatpickr UI,
4640
* by ensuring such `<input>` hits `.contains()` search from `fp.config.ignoredFocusElements`.
4741
* Without that, Flatpickr clears the `<input>` when end date hasn't been selected yet (which we don't want).

0 commit comments

Comments
 (0)