ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

Entire view can be slided up when ion-content and ion-footer-bar are used together

Open CoenWarmer opened this issue 12 years ago • 35 comments

First off congrats on the release of beta2! Ionic keeps improving and that's great.

I just upgraded my project to beta2 and I am seeing some issues. One I reported on the forums in the topic about testing the new taps (but that topic seems to have been removed? I can't find it anymore on the forum) is this:

When using ion-content and ion-footer-bar in one partial, it is possible to drag the whole view up and down, sliding everything (ion-header-bar, ion-content and ion-footer-bar under the status bar for about 5-10 pixels.

I'm using this partial:

<ion-view title="Information">

  <ion-content class="has-header has-footer" scroll="false" padding="false">
  Stuff
  </ion-content>

  <ion-footer-bar class="bar-clear">
   Stuff
  </ion-footer-bar>

</ion-view>

Steps to reproduce:

  1. Load this partial on device or simulator.
  2. Put your finger anywhere on the screen
  3. Move upwards then downwards
  4. Observe how whole view drags up 5 to 10 pixels.

When you remove ion-footer-bar, the whole view isn't draggable anymore (as it should be).

Version: 1.0.0 beta2 Platform: Everything that uses Cordova

CoenWarmer avatar Apr 29 '14 00:04 CoenWarmer

@blakerego I think this might solve your issue. Try adding the "has-header" class on your directives:
ion-content class="has-header" overflow-scroll="true" scroll

seyuf avatar Jun 03 '15 17:06 seyuf

@seyuf The StatusBar was not the main issue I was trying to solve - it was more that whenever I deployed the app, the entire screen would move around if dragged (when using <ion-content scroll="false" ...>). This wouldn't occur on the simulator, or in a web environment, only on the device itself. Setting the position of the main pane to 'fixed' seemed to resolve this for me.

blakerego avatar Jun 03 '15 17:06 blakerego

@blakerego Humm i see, the issue is may be linked to the os version on the device. Anyway, could you give your specs so that people with the same issue can apply your solution (os version, device...)?

seyuf avatar Jun 03 '15 17:06 seyuf

Sure, I'm on an iPod-touch, 5th Generation running iOS version 8.3 (12F69). Other members on my team also experienced this when deploying our app to their iPhones.

Note that I'm also using the 'org.apache.cordova.statusbar' cordova plugin, in case that affects anything.

blakerego avatar Jun 03 '15 17:06 blakerego

Solution: when using scroll="true" a div is auto generated with a class="scroll" I think that class as an height try make the height bigger.

djorocas avatar Dec 02 '15 12:12 djorocas

Thanks @djorocas , you're correct. The problem is that the inner scroll div did not have the correct height, so scrolling failed. I've created a small directive that you can use on the ion-content element that fixes this issue. It takes the parent's height, and applies it to the child div -

I've set my 'cons' to 53 + 60 px, but this will probably vary, depending on your situation.

myModule.directive('ensureScroll', [
  function() {
    var directive = {

      link: function(scope, element){
        var heightSetter = element.parent()[0];
        var height = heightSetter.offsetHeight;
        var target = element.children()[0];
        var cons = 53 + //header
                   60;  //subheader
        $(target).height(height + cons);
      }
    };
    return directive;
}]);

The markup will look like - <div class="height-needed"> <ion-content ensure-scroll> ... </ion-content> </div>

blakerego avatar Dec 10 '15 20:12 blakerego

I have tried all of the suggestions here and this problem is still occurring, seems that no matter what, the "page" is always "longer" than the "screen" and therefore it can be scrolled a bit putting a part of the header under the status bar. This is making the APP look and feel like a webpage instead of a native app. Please help!

17holeinone avatar Feb 27 '16 07:02 17holeinone

I have the same issue @17holeinone if you find a solution please let me know.

ronisgracie avatar Feb 29 '16 21:02 ronisgracie

I managed to fix this by tweaking some of the values in the ionic.css file, namely .has-header, .has-subheader and .has-tabs-tops I also changed the height of the .view-container to 96% instead of 100% and that helped.

This wasn't perfect ...

In any case I am not in need of this anymore since I decided to change the app a bit and started using a Side Menu for navigation instead of tabs ...

17holeinone avatar Feb 29 '16 22:02 17holeinone

phew, this is quite a big but, on Android the issue is also present but far less noticable there is only a slight drag shadow, but it shouldnt be there as well. Anyone got a good fix for this one? I tried all of these and they didnt work

    <preference name="webviewbounce" value="false" />
    <preference name="UIWebViewBounce" value="false" />
    <preference name="DisallowOverscroll" value="true" />
    <preference name="disallowOverscroll" value="true" />

Freundschaft avatar Mar 22 '16 00:03 Freundschaft

Hi, for anybody still stumbling over this, we just solved this in our own meteoric-fork of ionic by setting the body to position:relative. For some reason that wasn't set and setting it did fix this for us.

Yay! :D

DanielDornhardt avatar May 02 '16 17:05 DanielDornhardt

Just ran into this issue.. None of the above worked for me... any suggestions?!

feliperugai avatar Mar 24 '17 21:03 feliperugai

Okay, somehow I fixed this by setting:

.view-container {
   position: fixed;
}

Instead of position: absolute;

1BJK903 avatar Dec 02 '17 14:12 1BJK903

@1BJK903 It's fixed for now 🤣. Thanks mate

sarthology avatar Jun 14 '18 15:06 sarthology

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[bot] avatar Sep 01 '18 04:09 ionitron-bot[bot]