Repository navigation
Closed
Labels
Description
Bug Report
Ionic version:
[x] 4.x
Current behavior:
When focussing an ion-input element in iOS, the keyboard opens and scroll up so that the input is properly in view. If you focus another input just below it, keeping the keyboard active, the view scrolls down so that the input is halfway covered by the header.
Expected behavior:
When focussing the second ion-input I expect the view to scroll to a position where the ion-input is centered in the view.
Steps to reproduce:
Select an ion-input. When the keyboard is open, select an ion-input below it. The second input should be positioned somewhere halfway under the header.
Related code:
<ion-list class="data-form__content">
<ion-item class="data-form__content__item">
<ion-label color="secondary" position="stacked">Voornaam</ion-label>
<ion-input
[(ngModel)]="info.klant_naam"
type="text">
</ion-input>
</ion-item>
<ion-item class="data-form__content__item">
<ion-label color="secondary" position="stacked">Voorletters</ion-label>
<ion-input
[(ngModel)]="info.klant_voorletters"
type="text">
</ion-input>
</ion-item>
<ion-item class="data-form__content__item">
<ion-label color="secondary" position="stacked">Achternaam</ion-label>
<ion-input
[(ngModel)]="info.klant_achternaam"
type="text">
</ion-input>
</ion-item>
....
</ion-list>
Other information:
I'm opening this as a new issue based on this issue, as it was locked by the ionic bot.
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.10.1 (C:\Users\sjoerd\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : @ionic/angular 4.0.0
@angular-devkit/build-angular : 0.9.0-rc.1
@angular-devkit/schematics : 7.0.0-rc.1
@angular/cli : 7.0.0-rc.1
@ionic/angular-toolkit : not installed
Capacitor:
capacitor (Capacitor CLI) : 1.0.0-beta.17
@capacitor/core : 1.0.0-beta.17
System:
NodeJS : v10.11.0 (C:\Program Files\nodejs\node.exe)
npm : 6.6.0
OS : Windows 10
Reacted by Bas Hoogzaad, Kyle Abens, Mikhail Smirnov, Domenic, Denis Roldán, ippei and Richard Francis
Reacted by Eugene
Metadata
Metadata
Assignees
Labels
Type
Fields
No fields configured for issues without a type.
Activity
SmirnovM91 commentedon Feb 12, 2019
+1
MRvanderPants commentedon Mar 19, 2019
Any updates on this?
alexdiaz commentedon Apr 16, 2019
+1
alexdiaz commentedon Apr 16, 2019
Same issue
Example code:
Video demo:
https://vimeo.com/330719598
Ionic info:
denisroldan commentedon Apr 24, 2019
Same here:
Code:
Ionic info:
Video:
https://youtu.be/rU4fLYNtIMQ
pegler commentedon Apr 25, 2019
I believe at least one issue here is that the calculations to decide how far to scroll doesn't take into account if the keyboard is open or not. In my testing, the scrolling works as intended when the keyboard is closed, but changing focus from one input to another while the keyboard is open causes the scroll to be incorrect.
Here's the relevant code from what I can tell: https://github.com/ionic-team/ionic/blob/58c2a911d54a9ab4641e178f8774ee1c56d6febe/core/src/utils/input-shims/hacks/scroll-data.ts#L21
It looks like @brandyscarney worked on an ios scrolling related issue here that got me going down the right path.
I think the issue @denisroldan posted is slightly different since there are multiple ion-inputs in the same ion-item. The calculations for scrolling use the input's ion-item rather than the input itself, for some reason: https://github.com/ionic-team/ionic/blob/58c2a911d54a9ab4641e178f8774ee1c56d6febe/core/src/utils/input-shims/hacks/scroll-data.ts#L11
brandyscarney commentedon May 14, 2019
Thanks a ton to @pegler for working on this! I created a dev build with his PR:
4.5.0-dev.201905141454.56040e0if anyone would like to test it out and let us know if you see anything wrong. It seems to be working well for me, I will merge it in soon. 🙂pegler commentedon May 14, 2019
It's working great for me @brandyscarney. Thanks for the quick review and merge!
adamduren commentedon May 17, 2019
@brandyscarney Works for me as well. Was driving me insane! Thanks to everyone who made this happen. Any chance it can be a patch release?
4.4.1brandyscarney commentedon May 17, 2019
@adamduren It will be in the next patch release, scheduled next Wednesday.
merge release-4.4.1
ionitron-bot commentedon Jun 16, 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.