ionic-team / ionic-v1

The repo for Ionic 1.x. For the latest version of Ionic, please see https://github.com/ionic-team/ionic
Other
193 stars 187 forks source link

screen bounces when focusing inputs in a scrolling ion-content (web) #63

Open jgw96 opened 7 years ago

jgw96 commented 7 years ago

From @macool on November 25, 2016 6:4

Ionic version: [x] 1.x [ ] 2.x

I'm submitting a ... [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior: Switching betwen inputs inside an ion-content causes screen to awfully "bump". See example:

ionic-scrolling-bounces-before-patch

Expected behavior: js scrolling helps me showing the form in the right place - however the screen shouldn't be bumping that way

Steps to reproduce: switch between inputs inside a scrolling ion-content

http://plnkr.co/edit/FTIXiTalIrkNyYfwl25H?p=preview

unfortunately I can only see the issue in actual mobile devices via web - not in desktop web

-->

Related code:

insert any relevant code here

Other information: I managed to workaround the native version by disabling the keyboard scrolling using keyboard plugin. However been fighting with the web version and there seem to be some discussion around this already. eg #2256 & #2285 seem to be related.

I haven't had much time myself to look at the details but it all seems to be happening here: https://github.com/driftyco/ionic/blob/v1.3.2/js/utils/keyboard.js#L143 where we debounce the focus for the current input. While placing some debuggers I realised I can patch it by wrapping it inside a function, so my best guess is it's losing the context and therefore performing the focusing several times:

var debouncedKeyboardFocusIn = function() { ionic.debounce(keyboardFocusIn, 200, true) };

and it works like charm:

ionic-scrolling-bounces-after-patch

Ionic info:

Your system information:

Cordova CLI: 5.4.0
Gulp version:  CLI version 3.9.0
Gulp local:   Local version 3.9.1
Ionic CLI Version: 1.7.15
Ionic App Lib Version: 0.7.2
ios-deploy version: Not installed
ios-sim version: 5.0.11
OS: Mac OS X El Capitan
Node Version: v0.12.5
Xcode version: Xcode 8.1 Build version 8B62

Copied from original issue: driftyco/ionic#9346

jgw96 commented 7 years ago

Hello @macool ! Thanks for opening an issue with us! Would you mind trying the latest nightly (npm install ionic-angular@nightly --save) and trying again? I am not able to reproduce this with the latest nightly

azachar commented 6 years ago

Hello, do you plan to back ported to ionic v1? Thanks!