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: Ionic 4 - position: fixed not working after pulling down an ion-refresher

See original GitHub issue

Bug Report

Ionic version:

[x] 4.x

Current behavior:

This issue appears to be similar to: https://github.com/ionic-team/ionic/issues/13237 After pulling down an ion-refresher in a page that have also fixed elements (E.G.: A fixed button bar on the bottom), the position: fixed on the other elements stops to follow the page scroll (see this GIF: https://mega.nz/#!7OIEjY7I!ZqnmZi3eMVcrr6isyX7qWAK3M44EuG--a3kM1dfZATs ). This issue have also effect if - during the refresh - you hide other elements with ngIf

Expected behavior:

The refresher should not impact the position behavior of other elements

Steps to reproduce:

Create a page with an ion refresher and some elements with fixed position. Pull down the ion-refresher. Try to scroll up and down where the fixed elements are

Related code:

insert short code snippets here

Other information:

Ionic info:

insert the output from ionic info here

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
johnjenkinscommented, Oct 30, 2019

The issue is caused because the ion-content element gets a ‘transform: translateZ(0)’ - which means fixed elements are fixed in relation to the content element instead of the document. After refresh completes, you can remove this property and all will be well.

You can get the ion-content element using the ‘scrollContentRef.getScrollElement()’ method

1reaction
popovicanjacommented, Apr 23, 2020

@johnjenkins Hey, this solution works for me! Thanks! Here is my code snippet:

@ViewChild(IonContent, {static: false}) ionContentEl: IonContent;

onPullRefresh(event) {
    setTimeout(() => {
      event.target.complete();
      this.callService.
          .then((data) => {
            // handle data
            this.ionContentEl.getScrollElement().then((el) => {
              el.style.transform = '';
            });
          });
    });
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

Ionic 4 - position: fixed not working after pulling down an ion ...
Steps to reproduce: Create a page with an ion refresher and some elements with fixed position. Pull down the ion-refresher. Try to scroll...
Read more >
ion-refresher bug in ionic - Stack Overflow
but when i navigate to another page, and try to call the other ion-refresher, the refresher doenst pull and doenst refresh the page,...
Read more >
ion-content - Ionic Framework
ion -content provides an easy to use content area with useful methods to control the scrollable area. Learn more about this CSS component...
Read more >
ion-refresher causing fixed elements to scroll - You.com
When you refresh, it will move down your scroll-content, where your fixed container is placed in. <ion-toolbar> should fix this problem. Open side...
Read more >
Ionic 5 Pull/ Swipe Down to Refresh on Ionic Page Tutorial ...
In this Ionic 5/4 tutorial, we'll discuss pull or swipe down the page to refresh functionality in Ionic Angular application using the UI ......
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