bug: autofocus input causes modal animation be incorrect on ios
See original GitHub issueBug Report
Ionic version:
[x] 4.x
Current behavior:
The same issue as reported in #16136: When setting autofocus on an ion-input element in a modal in ios, the modal content disappears.
Expected behavior:
The modal content does not disappear.
Steps to reproduce:
- Create an Ionic App
- Create a Modal with
const modal = await this.modalController.create({...
- Set autofocus on an ion-input element in the modal component
Related code:
modal.component.html
:
<ion-header>
<ion-toolbar>
<ion-title>Some Modal Component</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-item>
<ion-label position="floating">Some Input</ion-label>
<ion-input type="text" autofocus></ion-input>
</ion-item>
</ion-content>
Other information:
Related issue: #16136
Ionic info:
Ionic:
ionic (Ionic CLI) : 4.12.0
Ionic Framework : @ionic/angular 4.4.0
@angular-devkit/build-angular : 0.13.8
@angular-devkit/schematics : 7.3.8
@angular/cli : 7.3.8
@ionic/angular-toolkit : 1.5.1
Cordova:
cordova (Cordova CLI) : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4, ios 4.5.5
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.0.1, (and 4 other plugins)
System:
Android SDK Tools : 26.1.1
NodeJS : v11.9.0
npm : 6.9.0
OS : macOS Mojave
Xcode : Xcode 10.2.1 Build version 10E1001
Issue Analytics
- State:
- Created 4 years ago
- Reactions:11
- Comments:8 (2 by maintainers)
Top Results From Across the Web
bug: autofocus input causes modal animation be incorrect on ...
Hi everyone,. This issue appears to be due to a bug in WebKit (the engine that powers Safari) where autofocus causes animations to...
Read more >How to prevent iOS keyboard from pushing the view off screen ...
It's a problem because I need users to be able to see content at the top of the modal while, simultaneously, I'd like...
Read more >Safari Technology Preview Release Notes - Apple Developer
Fixed an issue where browser.tabs sometimes returned an incorrect URL for pinned tabs. Bug Fixes. Fixed the Share Menu when sharing an image...
Read more >Dialog Focus in Screen Readers - Adrian Roselli
Managing focus for a modal is conceptually straightforward. Whatever launched the modal receives focus again when the modal closes. Easy-peasy.
Read more >Focus management with Vue refs - Learn web development
Vue components are written as a combination of JavaScript objects that manage the app's data and an HTML-based template syntax that maps to ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi everyone,
This issue appears to be due to a bug in WebKit (the engine that powers Safari) where
autofocus
causes animations to be run incorrectly. I will look into filing an issue with the WebKit team.As of now, I am not aware of a workaround but I will post here if I find one.
Same here, caused the modal to jump up past the top of the screen then back down, removed autofocus and it animates correctly. This only happened on iOS phones, Safari and Chrome.