Skip to content

bug: Modal in Ionic 6 not scrolling to end #24478

Closed

Description

@rluttikhuizen

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

We have modals with an IonHeader and IonContent element. Whenever the content takes up more (vertical) space than available, the IonContent displays a scrollbar. In Ionic React 5, the vertical scrollbar allows us to correctly scroll to the bottom of the content.

We recently upgraded from Ionic React 5 to Ionic React 6. After the upgrade to Ionic React 6, you can still scroll, but the bottom part of the IonContent is not shown. You cannot scroll the last part into the view.

When inspecting the modal in an Element Inspector, we see that the height of the IonHeader is not taken into account when determining the size of the IonContent. In other words, the IonContent height is being “oversized” with the same amount of pixels as the height of the IonHeader. That causes the y-scroll to not work as expected: we cannot scroll to bottom part of the content into view.

Expected Behavior

Expected behavior is that we are able to scroll to the bottom and that it will display the bottom content.

Steps to Reproduce

See https://codesandbox.io/s/ionic6modals-ht6rh.

In Tab1 we have an IonModal containing an IonHeader and IonContent. You can scroll, but not scroll so that the last item (with text *** END ****) is visible.

In Tab2 we have an IonModal containing an IonContent but no IonHeader. You can scroll, and also see the last item (with text *** END ****).

Code Reproduction URL

https://codesandbox.io/s/ionic6modals-ht6rh

Ionic Info

Ionic:

Ionic CLI : 6.18.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/react 6.0.1

Capacitor:

Capacitor CLI : 3.3.3
@capacitor/android : not installed
@capacitor/core : 3.3.3
@capacitor/ios : not installed

Utility:

cordova-res (update available: 0.15.4) : 0.15.1
native-run : 1.5.0

System:

NodeJS : v16.13.1 (/usr/local/Cellar/node@16/16.13.1/libexec/node)
npm : 8.1.2
OS : macOS Monterey

Additional Information

Note that the scroll behavior is correct when wrapping the IonHeader and IonContent in an IonPage like so:

<IonModal>
  <IonPage>
    <IonHeader><IonToolbar><IonTitle>modal title</IonTitle></IonToolbar></IonHeader>
    <IonContent>lots of content here</IonContent>
  </IonPage>
</IonModal>

But I’m hesitant to do that since IonPage is used for lifecycle behavior, and we are warned 😃 to not wrap elements in an IonPage (e.g. https://forum.ionicframework.com/t/what-about-ion-page-or-ionpage/185083/2).

Activity

  1. added
    holiday triage
    on Dec 22, 2021
  2. ionitron-bot commented on Dec 22, 2021

    @ionitron-bot

    Thanks for the issue! This issue has been labeled as holiday triage. With the winter holidays quickly approaching, much of the Ionic Team will soon be taking time off. During this time, issue triaging and PR review will be delayed until the team begins to return. After this period, we will work to ensure that all new issues are properly triaged and that new PRs are reviewed.

    In the meantime, please read our Winter Holiday Triage Guide for information on how to ensure that your issue is triaged correctly.

    Thank you!

  3. johanhoglund commented on Dec 31, 2021

    @johanhoglund

    I can report that this is happening in my project as well when I attempt to upgrade to version 6.

  4. sean-perkins commented on Jan 5, 2022

    @sean-perkins
    Contributor

    @rluttikhuizen thanks for reporting this issue.

    This looks like a regression to inline overlay components in our React implementation. I'll create a PR to address this soon.

  5. added
    package: react
    type: bug
    on Jan 5, 2022
  6. removed
    holiday triage
    on Jan 5, 2022
  7. added a commit that references this issue on Jan 5, 2022
    a2f86f0
  8. rluttikhuizen commented on Jan 11, 2022

    @rluttikhuizen
    Author

    Fix is part of release 6.0.2 which is released 👍

  9. ionitron-bot commented on Feb 10, 2022

    @ionitron-bot

    Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

  10. locked and limited conversation to collaborators on Feb 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    package: reacttype: bug

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions