question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug: collapsible header resets scroll position when triggered by iOS overscroll

See original GitHub issue

Bug Report

Ionic version: [x] 4.x

Current behavior: When using a collapsible header with a large title on a page that’s not high enough to scroll only the iOS overscroll functionality takes effect. When the page is scrolled until the point where the opacity of the main and the scroll header is toggled the scroll position is reset which causes a quit ugly and janky behaviour.

ezgif com-crop

Expected behavior: It works the same way no matter if its normal scrolling or overscrolling.

Steps to reproduce: Place a collapsible header in an otherwise empty ion-content, run it on an iOS device and try to scroll the page until the point where the scroll header should be hidden and the main header should be visible.

Related code: If I remove all function calls where the scroll header is activated/deactivated: https://github.com/ionic-team/ionic/blob/0a7aae28a7eb0270cdcd100933c01850403b66db/core/src/components/header/header.utils.ts#L104 https://github.com/ionic-team/ionic/blob/0a7aae28a7eb0270cdcd100933c01850403b66db/core/src/components/header/header.utils.ts#L119 and also the calls where the opacity of the main toolbar is changed: https://github.com/ionic-team/ionic/blob/0a7aae28a7eb0270cdcd100933c01850403b66db/core/src/components/header/header.utils.ts#L63

…it works like expected.

ezgif com-crop-2

Let me know if you should need an example repo, but it should be quite easy to reproduce it from the example code from the docs.

Other information: Related to overscroll but more of a performance thing: you could possible save a few DOM writes here: https://github.com/ionic-team/ionic/blob/0a7aae28a7eb0270cdcd100933c01850403b66db/core/src/components/header/header.utils.ts#L52 if you only actually scale the title if scrollTop is <= 0, overscroll(-top) is always a positive margin and always results in scale being 1.

Ionic info:

Ionic:
   Ionic CLI                     : 5.4.5 (/usr/local/lib/node_modules/ionic)
   Ionic Framework               : @ionic/angular 4.11.3
   @angular-devkit/build-angular : 0.803.12
   @angular-devkit/schematics    : 8.3.12
   @angular/cli                  : 8.3.12
   @ionic/angular-toolkit        : 2.0.0

Cordova:
   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.0.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.1.2, (and 26 other plugins)

Utility:
   cordova-res : not installed
   native-run  : not installed

System:
   ios-deploy : 1.9.2
   ios-sim    : 8.0.2
   NodeJS     : v12.4.0 (/usr/local/bin/node)
   npm        : 6.11.3
   OS         : macOS Catalina
   Xcode      : Xcode 11.2 Build version 11B52

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
liamdebeasicommented, Nov 7, 2019

Glad to hear the issue is resolved! This dev build didn’t include the fix in https://github.com/ionic-team/ionic/pull/19682 so that’s why it still has that behavior.

0reactions
ionitron-bot[bot]commented, Dec 7, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

bug: collapsible header resets scroll position when triggered ...
Current behavior: When using a collapsible header with a large title on a page that's not high enough to scroll only the iOS...
Read more >
overscroll-behavior - CSS: Cascading Style Sheets | MDN
The overscroll-behavior CSS property sets what a browser does when reaching the boundary of a scrolling area.
Read more >
Fixed header is jumping and flickering when it's scrolled with ...
The issue is that a fixed header is jumping and flickering when it's scrolled. This issue is only visible with iPhone/iOS. (I tested...
Read more >
Safari Technology Preview Release Notes - Apple Developer
Fixed flickering while scrolling when the keyboard scrolling spring damping ... Fixed scroll-chaining to trigger before the complete end of overscroll ...
Read more >
FlatList - React Native
Optional horizontal mode. Configurable viewability callbacks. Header support. Footer support. Separator support. Pull to Refresh. Scroll loading ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found