Skip to content

bug: Swipeable Segments - vertical scrolling should be disabled #30001

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
Hesesses opened this issue Nov 5, 2024 · 15 comments · Fixed by #30276
Closed
3 tasks done

bug: Swipeable Segments - vertical scrolling should be disabled #30001

Hesesses opened this issue Nov 5, 2024 · 15 comments · Fixed by #30276
Labels
type: bug a confirmed bug report

Comments

@Hesesses
Copy link

Hesesses commented Nov 5, 2024

Prerequisites

Ionic Framework Version

v8.x

Current Behavior

When swiping between the views, it should only scroll horizontally, not vertically

See video:

RPReplay_Final1730847719.MP4

Expected Behavior

Only scrolling horizontally

See video:

RPReplay_Final1730847678.MP4

Steps to Reproduce

See both videos above

Code Reproduction URL

no url

Ionic Info

Ionic:

Ionic CLI : 7.2.0 (/Users/.../.nvm/versions/node/v18.20.4/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 8.4.0
@angular-devkit/build-angular : 17.3.11
@angular-devkit/schematics : 17.3.11
@angular/cli : 17.3.11
@ionic/angular-toolkit : 11.0.1

Capacitor:

Capacitor CLI : 6.1.2
@capacitor/android : 6.1.2
@capacitor/core : 6.1.2
@capacitor/ios : 6.1.2

Utility:

cordova-res : not installed globally
native-run : 2.0.1

System:

NodeJS : v18.20.4 (/Users/.../.nvm/versions/node/v18.20.4/bin/node)
npm : 10.7.0
OS : macOS Unknown

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Nov 5, 2024
@moberwasserlechner
Copy link

I experience the same behavior using the latest ionic version.

As a workaround until this is fixed I put an "ion-content" inside of the "ion-segment-content"

<ion-segment-view>
  <ion-segment-content id="data">
    <ion-content color="light">
    </ion-content>
  </ion-segment-content>
</ion-segment-view>

@tanner-reits
Copy link
Contributor

@Hesesses Thanks for the issue! Definitely a small oversight on my part during the implementation. Will get this fixed!

@tanner-reits tanner-reits added type: bug a confirmed bug report and removed triage labels Nov 21, 2024
@tanner-reits
Copy link
Contributor

@Hesesses Do you have a repro or possibly just a snippet of your code/CSS? I haven't been able to reproduce the behavior in the browser or a capacitor app.

@Hesesses
Copy link
Author

I havent played this anymore after the issue created but i think the problem is when the content height is more than 100vh.

view:

<div class="ion-page" #pageElem>
  <ion-header class="ion-no-border">
    <ion-toolbar>
      ...
    </ion-toolbar>
  </ion-header>
  <ion-content [fullscreen]="true">
    <ion-header collapse="condense">
      <ion-toolbar>
        ....
      </ion-toolbar>
    </ion-header>
    <div class="ion-padding py-0 bg-secondary-600 sticky top-[-1px] z-50">
      <pd-tabs [buttons]="tabs" [value]="currentTab" (onChange)="onTabChange($event)"></pd-tabs>
    </div>
    
    <ion-segment-view>
      <ion-segment-content id="general">
        <app-league-general-tab [league]="league"></app-league-general-tab>
      </ion-segment-content>
      <ion-segment-content id="categories">
        <app-league-categories-tab [league]="league"></app-league-categories-tab>
      </ion-segment-content>
      <ion-segment-content id="information">
        <app-league-information-tab [league]="league"></app-league-information-tab>

      </ion-segment-content>
    </ion-segment-view>
  </ion-content>

</div>

my pd-tabs component:

<ion-segment mode="md" [value]="value" (ionChange)="onChange.emit($event)" [scrollable]="true">
  <ion-segment-button [value]="" content-id="general" style="margin-right:0px"></ion-segment-button>
  @for (button of buttons; track button.label) {
    <ion-segment-button [value]="button.value" [contentId]="button.value">
      <ion-label>
        {{ button.label }}
        </ion-label>
    </ion-segment-button>
  }
</ion-segment>

league-information-tab

<div class="ion-padding" innerHtml="{{ 'LEAGUE.TABS.INFORMATION.INFO' | translate }}">
  
</div>

@tanner-reits
Copy link
Contributor

@Hesesses Sorry for the delay again, was out for the Holiday last week. I was able to reproduce the behavior when setting a height > 100vh on the ion-segment-content instances. However, I noticed this isn't an issue if you set the height on the ion-segment-view element instead, which feels like the more correct approach here to ensure that each child (i.e. the segment content) gets the same height when swiping between them.

Any reason this approach wouldn't work for you?

@Hesesses
Copy link
Author

Hesesses commented Dec 2, 2024

I tried to add height for ion-segment-view but it didnt change anything... For me the only way to fix this is to use <ion-content> as @moberwasserlechner suggested

@tanner-reits
Copy link
Contributor

@Hesesses I'm not seeing the multi-scroll behavior when setting height on the ion-segment-view (i've tried with the ion-segment in the ion-content as well as in the header). Can you create either a StackBlitz or repro repo showing the issue?

@Hesesses
Copy link
Author

Hesesses commented Dec 8, 2024

Is it possible for you to give example how its working for you? I have tried to set height on ion-segment-view (100%, 100vh and different pixel variations) without success

@tanner-reits
Copy link
Contributor

@Hesesses A simple use case where you can see it is the Ionic docs Stackblitz example setting the height to 200vh. This obviously doesn't account for the specifics of your project, but I used the snippets of the code you provided (as best I could without complete reproduction) and didn't have an issue. That can be found here.

@tanner-reits tanner-reits added the needs: reply the issue needs a response from the user label Dec 12, 2024
@ionitron-bot ionitron-bot bot added triage and removed needs: reply the issue needs a response from the user labels Dec 13, 2024
@Hesesses
Copy link
Author

@tanner-reits is there something more you would like to know about this?

@ccapndave
Copy link

I also experienced this and also have temporarily worked around it with the IonContent.

@thetaPC thetaPC removed the triage label Mar 17, 2025
github-merge-queue bot pushed a commit that referenced this issue Apr 2, 2025
…ly (#30276)

Issue number: resolves #30001 

---------

<!-- Please do not submit updates to dependencies unless it fixes an
issue. -->

<!-- Please try to limit your pull request to one type (bugfix, feature,
etc). Submit multiple pull requests if needed. -->

## What is the current behavior?
<!-- Please describe the current behavior that you are modifying. -->

When segment view has content that is long enough to render outside of
the viewport, then a user can scroll vertically and horizontally when
the user scrolled down to see the content at the bottom. This causes
disorientation as scrolling should only be in one direction.

This only happens on a mobile device, specifically Android. It can be
reproduce with a browser simulator.

## What is the new behavior?
<!-- Please describe the behavior or changes that are being added by
this PR. -->

- Updated styling to take into account that content might be outside of
the viewport.

## Does this introduce a breaking change?

- [ ] Yes
- [x] No

<!--
  If this introduces a breaking change:
1. Describe the impact and migration path for existing applications
below.
  2. Update the BREAKING.md file with the breaking change.
3. Add "BREAKING CHANGE: [...]" to the commit description when merging.
See
https://github.com/ionic-team/ionic-framework/blob/main/docs/CONTRIBUTING.md#footer
for more information.
-->


## Other information

<!-- Any other information that is important to this PR such as
screenshots of how the component looks before and after the change. -->

Dev build: `8.5.2-dev.11743531350.19e040aa`
@thetaPC
Copy link
Contributor

thetaPC commented Apr 2, 2025

Thanks for the issue! This has been resolved via PR #30276 and will be available in an upcoming release of Ionic.

@thetaPC
Copy link
Contributor

thetaPC commented Apr 2, 2025

This issue was fixed in v8.5.3! Please update to the latest version to receive the fix.

Copy link

ionitron-bot bot commented May 2, 2025

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.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators May 2, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants