From 957604c3a045130e90c9c1d8062be1272ecb6279 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 13 Feb 2024 11:57:47 -0500 Subject: [PATCH] refactor(datetime): remove safari 14 hack (#29035) Issue number: Internal --------- ## What is the current behavior? This code was added to account for a Safari 14 issue that would cause datetime to render incorrectly. The Safari bug was fixed starting in Safari 15. However, Ionic v7 supported back to Safari 14. More context is available [here](https://github.com/ionic-team/ionic-framework/pull/24421#discussion_r796113907) ## What is the new behavior? - Removed the Safari 14 workarounds since Ionic v8 does not support Safari 14 I tested on iOS 15, 16, and 17 to verify that removing this hack does not cause any issues. Also verified that removing this hack does reproduce the issue on iOS 14 (to verify that I am reproducing the original issue correctly) ## Does this introduce a breaking change? - [ ] Yes - [x] No ## Other information --- core/src/components/datetime/datetime.tsx | 48 ----------------------- 1 file changed, 48 deletions(-) diff --git a/core/src/components/datetime/datetime.tsx b/core/src/components/datetime/datetime.tsx index 579bfa980d..fea00902e8 100644 --- a/core/src/components/datetime/datetime.tsx +++ b/core/src/components/datetime/datetime.tsx @@ -1662,14 +1662,6 @@ export class Datetime implements ComponentInterface { disabled={disabled} value={todayString} onIonChange={(ev: CustomEvent) => { - // TODO(FW-1823) Remove this when iOS 14 support is dropped. - // Due to a Safari 14 issue we need to destroy - // the scroll listener before we update state - // and trigger a re-render. - if (this.destroyCalendarListener) { - this.destroyCalendarListener(); - } - const { value } = ev.detail; const findPart = parts.find(({ month, day, year }) => value === `${year}-${month}-${day}`); @@ -1683,10 +1675,6 @@ export class Datetime implements ComponentInterface { ...findPart, }); - // We can re-attach the scroll listener after - // the working parts have been updated. - this.initializeCalendarListener(); - ev.stopPropagation(); }} > @@ -1793,14 +1781,6 @@ export class Datetime implements ComponentInterface { disabled={disabled} value={pickerColumnValue} onIonChange={(ev: CustomEvent) => { - // TODO(FW-1823) Remove this when iOS 14 support is dropped. - // Due to a Safari 14 issue we need to destroy - // the scroll listener before we update state - // and trigger a re-render. - if (this.destroyCalendarListener) { - this.destroyCalendarListener(); - } - this.setWorkingParts({ ...workingParts, day: ev.detail.value, @@ -1811,10 +1791,6 @@ export class Datetime implements ComponentInterface { day: ev.detail.value, }); - // We can re-attach the scroll listener after - // the working parts have been updated. - this.initializeCalendarListener(); - ev.stopPropagation(); }} > @@ -1848,14 +1824,6 @@ export class Datetime implements ComponentInterface { disabled={disabled} value={workingParts.month} onIonChange={(ev: CustomEvent) => { - // TODO(FW-1823) Remove this when iOS 14 support is dropped. - // Due to a Safari 14 issue we need to destroy - // the scroll listener before we update state - // and trigger a re-render. - if (this.destroyCalendarListener) { - this.destroyCalendarListener(); - } - this.setWorkingParts({ ...workingParts, month: ev.detail.value, @@ -1866,10 +1834,6 @@ export class Datetime implements ComponentInterface { month: ev.detail.value, }); - // We can re-attach the scroll listener after - // the working parts have been updated. - this.initializeCalendarListener(); - ev.stopPropagation(); }} > @@ -1902,14 +1866,6 @@ export class Datetime implements ComponentInterface { disabled={disabled} value={workingParts.year} onIonChange={(ev: CustomEvent) => { - // TODO(FW-1823) Remove this when iOS 14 support is dropped. - // Due to a Safari 14 issue we need to destroy - // the scroll listener before we update state - // and trigger a re-render. - if (this.destroyCalendarListener) { - this.destroyCalendarListener(); - } - this.setWorkingParts({ ...workingParts, year: ev.detail.value, @@ -1920,10 +1876,6 @@ export class Datetime implements ComponentInterface { year: ev.detail.value, }); - // We can re-attach the scroll listener after - // the working parts have been updated. - this.initializeCalendarListener(); - ev.stopPropagation(); }} >