Ionic 4 - Ion-Input autofocuses every time
See original GitHub issueBug Report
Ionic Info
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 2.0.0-rc.6
ionic (Ionic CLI) : 4.0.0-rc.6
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
@angular-devkit/core : 0.6.8
@angular-devkit/schematics : 0.6.8
@angular/cli : 6.0.8
@ionic/schematics-angular : 1.0.0-rc.6
Cordova Platforms : android 7.1.0 ios 4.5.4
Ionic Framework : @ionic/angular 4.0.0-alpha.7
System:
NodeJS : v8.10.0
npm : 6.1.0
OS : macOS High Sierra
Xcode : Xcode 9.4 Build version 9F1027a
Environment Variables:
ANDROID_HOME : not set
Describe the Bug All ion-input tags will autofocus in IOS. This is because they add autofocus=“false” by default but the presence of the attribute autofocus will cause the input to autofocus regardless of the value. Note: this seems to be ok in Google Chrome but when deployed to IOS with wkwebview the problem surfaces.
Steps to Reproduce Steps to reproduce the behavior:
- Place an ion-input in a form
- Build and deploy the ionic app for IOS
- The input will be focused and the keyboard will appear
Expected Behavior By default there should not be autofocus in the generated input tag. If ion-input has the property of autofocus=“true” then the input tag should have an attribute of autofocus (doesnt require a value)
Additional Context Tested with IOS 11.4 on an iPhoneX. Note: problem may occur with chrome but isnt as visible as it doesnt cause an onscreen keyboard to appear.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:7 (4 by maintainers)

Top Related StackOverflow Question
4.0.0-beta.8
I am not able to get the
autofocusproperty to work on either Chrome or Safari for desktop web.It looks like the attribute gets set on the element but it never receives focus.
I am attempting to use it in modal dialogs to place the cursor in the first input but have not been able to get it to work for either
ion-inputorion-textareaelements.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.