Repository: ionic-team/ionic-framework
File: core/src/components/modal/gestures/sheet.ts (TypeScript)

Code before:
    }

    return true;
  };

  const onStart = (detail: GestureDetail) => {
    /**
     * If canDismiss is anything other than `true`
     * then users should be able to swipe down
     * until a threshold is hit. At that point,
     * the card modal should not proceed any further.
     *
     * canDismiss is never fired via gesture if there is
     * no 0 breakpoint. However, it can be fired if the user
     * presses Esc or the hardware back button.
     * TODO (FW-937)
     * Remove undefined check
     */
    canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0;

    /**
     * Cache the scroll element reference when the gesture starts,
     * this allows us to avoid querying the DOM for the target in onMove,
     * which would impact performance significantly.
     */
    const targetEl = findClosestIonContent(detail.event.target! as HTMLElement);
    cachedScrollEl =
      targetEl && isIonContent(targetEl) ? getElementRoot(targetEl).querySelector('.inner-scroll') : targetEl;

    /**
     * If expandToScroll is disabled, we need to swap
     * the footer visibility to the original, so if the modal
     * is dismissed, the footer dismisses with the modal
     * and doesn't stay on the screen after the modal is gone.
     */
    if (!expandToScroll) {
      swapFooterVisibility('original');
    }

    /**
     * If we are pulling down, then it is possible we are pulling on the content.
     * We do not want scrolling to happen at the same time as the gesture.
     */
    if (detail.deltaY > 0 && contentEl) {
      contentEl.scrollY = false;
    }

    raf(() => {
      /**
       * Dismisses the open keyboard when the sheet drag gesture is started.
       * Sets the focus onto the modal element.

Review comment (suggestion):
Maybe put this logic in an `if (!expandToScroll)`? To skip during gesture start for most scenarios that don't use it.

Code after:
    }

    return true;
  };

  const onStart = (detail: GestureDetail) => {
    /**
     * If canDismiss is anything other than `true`
     * then users should be able to swipe down
     * until a threshold is hit. At that point,
     * the card modal should not proceed any further.
     *
     * canDismiss is never fired via gesture if there is
     * no 0 breakpoint. However, it can be fired if the user
     * presses Esc or the hardware back button.
     * TODO (FW-937)
     * Remove undefined check
     */
    canDismissBlocksGesture = baseEl.canDismiss !== undefined && baseEl.canDismiss !== true && minBreakpoint === 0;

    /**
     * Cache the scroll element reference when the gesture starts,
     * this allows us to avoid querying the DOM for the target in onMove,
     * which would impact performance significantly.
     */
    if (!expandToScroll) {
      const targetEl = findClosestIonContent(detail.event.target! as HTMLElement);
      cachedScrollEl =
        targetEl && isIonContent(targetEl) ? getElementRoot(targetEl).querySelector('.inner-scroll') : targetEl;
    }

    /**
     * If expandToScroll is disabled, we need to swap
     * the footer visibility to the original, so if the modal
     * is dismissed, the footer dismisses with the modal
     * and doesn't stay on the screen after the modal is gone.
     */
    if (!expandToScroll) {
      swapFooterVisibility('original');
    }

    /**
     * If we are pulling down, then it is possible we are pulling on the content.
     * We do not want scrolling to happen at the same time as the gesture.
     */
    if (detail.deltaY > 0 && contentEl) {
      contentEl.scrollY = false;
    }

    raf(() => {
      /**