Repository: ionic-team/ionic-framework
File: core/src/components/modal/animations/ios.leave.ts (TypeScript)

Code before:
/**
 * iOS Modal Leave Animation
 */
export const iosLeaveAnimation = (baseEl: HTMLElement, opts: ModalAnimationOptions, duration = 500): Animation => {
  const { presentingEl, currentBreakpoint, scrollAtEdge } = opts;
  const root = getElementRoot(baseEl);
  const { wrapperAnimation, backdropAnimation } =
    currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation();

  backdropAnimation.addElement(root.querySelector('ion-backdrop')!);

  wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')!).beforeStyles({ opacity: 1 });

  const baseAnimation = createAnimation('leaving-base')
    .addElement(baseEl)
    .easing('cubic-bezier(0.32,0.72,0,1)')
    .duration(duration)
    .addAnimation(wrapperAnimation)
    .beforeAddWrite(() => {
      if (scrollAtEdge) {
        // Scroll can only be done when the modal is fully expanded.
        return;
      }

      /**
       * If scrollAtEdge is disabled, we need toß swap
       * the visibility to the original, so the footer
       *  dismisses with the modal and doesn't stay
       *  until the modal is removed from the DOM.
       */
      const ionFooter = baseEl.querySelector('ion-footer');
      if (ionFooter) {
        const clonedFooter = baseEl.shadowRoot!.querySelector('ion-footer')!;

        ionFooter.style.removeProperty('display');
        ionFooter.removeAttribute('aria-hidden');

        clonedFooter.style.setProperty('display', 'none');
        clonedFooter.setAttribute('aria-hidden', 'true');

        const page = baseEl.querySelector('.ion-page') as HTMLElement;
        page.style.setProperty('padding-bottom', `0`);
      }
    });

  if (presentingEl) {
    const isMobile = window.innerWidth < 768;
    const hasCardModal =
      presentingEl.tagName === 'ION-MODAL' && (presentingEl as HTMLIonModalElement).presentingElement !== undefined;
    const presentingElRoot = getElementRoot(presentingEl);


Review comment (suggestion):
```suggestion
       * If scrollAtEdge is disabled, we need to swap
```

Code after:
/**
 * iOS Modal Leave Animation
 */
export const iosLeaveAnimation = (baseEl: HTMLElement, opts: ModalAnimationOptions, duration = 500): Animation => {
  const { presentingEl, currentBreakpoint, expandToScroll } = opts;
  const root = getElementRoot(baseEl);
  const { wrapperAnimation, backdropAnimation } =
    currentBreakpoint !== undefined ? createSheetLeaveAnimation(opts) : createLeaveAnimation();

  backdropAnimation.addElement(root.querySelector('ion-backdrop')!);

  wrapperAnimation.addElement(root.querySelectorAll('.modal-wrapper, .modal-shadow')!).beforeStyles({ opacity: 1 });

  const baseAnimation = createAnimation('leaving-base')
    .addElement(baseEl)
    .easing('cubic-bezier(0.32,0.72,0,1)')
    .duration(duration)
    .addAnimation(wrapperAnimation)
    .beforeAddWrite(() => {
      if (expandToScroll) {
        // Scroll can only be done when the modal is fully expanded.
        return;
      }

      /**
       * If expandToScroll is disabled, we need to swap
       * the visibility to the original, so the footer
       * dismisses with the modal and doesn't stay
       * until the modal is removed from the DOM.
       */
      const ionFooter = baseEl.querySelector('ion-footer');
      if (ionFooter) {
        const clonedFooter = baseEl.shadowRoot!.querySelector('ion-footer')!;

        ionFooter.style.removeProperty('display');
        ionFooter.removeAttribute('aria-hidden');

        clonedFooter.style.setProperty('display', 'none');
        clonedFooter.setAttribute('aria-hidden', 'true');

        const page = baseEl.querySelector('.ion-page') as HTMLElement;
        page.style.removeProperty('padding-bottom');
      }
    });

  if (presentingEl) {
    const isMobile = window.innerWidth < 768;
    const hasCardModal =
      presentingEl.tagName === 'ION-MODAL' && (presentingEl as HTMLIonModalElement).presentingElement !== undefined;
    const presentingElRoot = getElementRoot(presentingEl);