Skip to content
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

bug: refresher triggers when scrolling up on custom scroll host #25318

Closed
4 of 7 tasks
TimGels opened this issue May 19, 2022 · 6 comments
Closed
4 of 7 tasks

bug: refresher triggers when scrolling up on custom scroll host #25318

TimGels opened this issue May 19, 2022 · 6 comments
Labels
package: core @ionic/core package type: bug a confirmed bug report

Comments

@TimGels
Copy link

TimGels commented May 19, 2022

Prerequisites

Ionic Framework Version

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

Current Behavior

When using the <ion-refresher-content> component in combination with Angular's <cdk-virtual-scroll-viewport> component, the refresher gets triggered when scrolling in the list. I also added the ion-content-scroll-host class to the <cdk-virtual-scroll-viewport> component to no avail.

2022-05-19.12-35-14.mp4

Expected Behavior

When using the <ion-refresher-content> component in combination with Angular's <cdk-virtual-scroll-viewport> component, the refresher should only be triggered when pulling at the start of the list.

Steps to Reproduce

  1. Run the repro Ionic application
  2. Put the screen in responsive mode like a phone screen
  3. Scroll down
  4. Scroll up without immediately releasing the mouse down / finger off the screen

Code Reproduction URL

https://github.com/TimGels/ionic-virtual-scroll-refresher-repro

Ionic Info

PS C:\Users\user\projects\ionic-virtual-scroll-refresher-repro> ionic info
[WARN] Error loading @capacitor/ios package.json: Error: Cannot find module '@capacitor/ios/package'

   Require stack:
   - C:\Users\user\AppData\Roaming\npm\node_modules\@ionic\cli\lib\project\index.js
   - C:\Users\user\AppData\Roaming\npm\node_modules\@ionic\cli\lib\index.js
   - C:\Users\user\AppData\Roaming\npm\node_modules\@ionic\cli\index.js
   - C:\Users\user\AppData\Roaming\npm\node_modules\@ionic\cli\bin\ionic

[WARN] Error loading @capacitor/android package.json: Error: Cannot find module '@capacitor/android/package'

   Require stack:
   - C:\Users\user\AppData\Roaming\npm\node_modules\@ionic\cli\lib\project\index.js
   - C:\Users\user\AppData\Roaming\npm\node_modules\@ionic\cli\lib\index.js
   - C:\Users\user\AppData\Roaming\npm\node_modules\@ionic\cli\index.js
   - C:\Users\user\AppData\Roaming\npm\node_modules\@ionic\cli\bin\ionic

Ionic:

Ionic CLI : 6.18.2 (C:\Users\user\AppData\Roaming\npm\node_modules@ionic\cli)
Ionic Framework : @ionic/angular 6.1.6
@angular-devkit/build-angular : 13.2.6
@angular-devkit/schematics : 13.2.6
@angular/cli : 13.2.6
@ionic/angular-toolkit : 6.1.0

Capacitor:

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

Utility:

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

System:

NodeJS : v16.14.0 (C:\Program Files\nodejs\node.exe)
npm : 8.3.1
OS : Windows 10

Additional Information

I followed the docs on the implementation of the virtual scrolling.

A related issue that I came across #23437

@ionitron-bot ionitron-bot bot added the triage label May 19, 2022
@liamdebeasi liamdebeasi self-assigned this May 19, 2022
@liamdebeasi
Copy link
Contributor

Thanks for the issue. I can reproduce this. This line likely needs to be changed: https://github.com/ionic-team/ionic-framework/blob/main/core/src/components/refresher/refresher.tsx#L439.

This function calls this.el.closest('ion-content, .ion-content-scroll-host'). However, since ion-refresher is not used inside of the virtual scroll viewport, this guarantees that it will never find the .ion-content-scroll-host element. As a result, it falls back to using the scroll element inside of ion-content. Since this scroll element always has scrollTop = 0, the refresher activates when scrolling up on the virtual scroll container.

@liamdebeasi liamdebeasi changed the title bug: Refresher triggers when scrolling up in <cdk-virtual-scroll-viewport> bug: refresher triggers when scrolling up on custom scroll host May 19, 2022
@liamdebeasi liamdebeasi added package: core @ionic/core package type: bug a confirmed bug report labels May 19, 2022
@liamdebeasi liamdebeasi removed their assignment May 19, 2022
@ionitron-bot ionitron-bot bot removed the triage label May 19, 2022
@WillooWisp
Copy link

I experience the same problem, any clues when a hot fix can be available?

@liamdebeasi
Copy link
Contributor

We will post on this thread when the issue is resolved.

@sean-perkins
Copy link
Contributor

Can someone test with this dev build: 6.1.7-dev.11653327570.1759e1d5?

I've confirmed locally with the reproduction app, but would appreciate additional testing. Thanks!

@WillooWisp
Copy link

I just verified the fix with "@ionic/angular": "6.1.7-dev.11653327570.1759e1d5" and it solves the issue.

@ionitron-bot
Copy link

ionitron-bot bot commented Jul 16, 2022

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 Jul 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: core @ionic/core package type: bug a confirmed bug report
Projects
None yet
Development

No branches or pull requests

4 participants