You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
iOS: Input fields don't loose focus when clicking outside #5020
I think this is kind of important. The keyboard cannot be dismissed on iOS during form capture. Is there any chance this can be moved into beta 4? Or is there a work around available?
Note that this happens on the iOS simulator and iOS devices.
@dylanvdmerwe: I ended up kludging a very blunt-force workaround when this issue came up in my user testing a few weeks ago. I can't say I recommend it and it almost certainly has problematic side-effects. But just in case the idea is helpful:
I added a click handler to my outermost ion-content directive that forcibly blurs any active text input field, so taps on the page background result in the desired outcome of removing focus from an input field and dismissing the keyboard.
Be warned that limited testing has already revealed that event bubbling defaults are very different on Android, where this caused inputs to be unselectable. The click event to focus an input was passed through to the parent directive which immediately unfocused it again.
blurActiveInput() {
if (!this.platform.is("iOS")) return;
var activeElement = document.activeElement;
if(activeElement.tagName == "INPUT" || activeElement.tagName == "TEXTAREA") {
activeElement.blur();
}
}
Same issue here, and I am really concerned about making workarounds with that kind of basic UI behaviors, specially if you are targeting more then one platform, which all of us probably do.
The team have any suggestion or any position about this issue?
I can only reproduce this in a private project. However, I was able to fix it by binding to the click event on <ion-nav> in app.html. For example: <ion-nav [root]="rootPage" #content swipeBackEnabled="false" (click)="return"></ion-nav>
I don't have the time to debug this myself now, but this suggests that there is a race condition of some sort causing this bug.
Has this got anything to do with Ionic ? This is a bug I find with safari on ios.
Once you focus on an input field or text field safari will not blur the element unless you click/touch another focusable element or you click the "Done" button on iphone or "keyboard close" button on ipad.
iOS 11.2.1 Phone
iOS 11.0.3 iPad
I would consider this a bug with iOS and safari but I would imagine in their eyes it is a feature : )
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.
Activity
dylanvdmerwe commentedon Mar 18, 2016
I think this is kind of important. The keyboard cannot be dismissed on iOS during form capture. Is there any chance this can be moved into beta 4? Or is there a work around available?
Note that this happens on the iOS simulator and iOS devices.
EvanWillms commentedon Apr 10, 2016
@dylanvdmerwe: I ended up kludging a very blunt-force workaround when this issue came up in my user testing a few weeks ago. I can't say I recommend it and it almost certainly has problematic side-effects. But just in case the idea is helpful:
I added a click handler to my outermost ion-content directive that forcibly blurs any active text input field, so taps on the page background result in the desired outcome of removing focus from an input field and dismissing the keyboard.
Be warned that limited testing has already revealed that event bubbling defaults are very different on Android, where this caused inputs to be unselectable. The click event to focus an input was passed through to the parent directive which immediately unfocused it again.
6 remaining items
paulparton commentedon Nov 12, 2016
I having this same issue with rc1 and rc2
bmagni commentedon Nov 17, 2016
Same problem here on IOS with :
Cordova CLI: 6.3.1
Ionic Framework Version: 2.0.0-rc.1
Ionic CLI Version: 2.1.4
jesusbotella commentedon Nov 17, 2016
@Xal3ph I used the solution provided by @EvanWillms, but unfortunately, I didn't find any other solution :(
willynilly commentedon Jan 2, 2017
Same issue.
wagner18 commentedon Jan 6, 2017
Same issue here, and I am really concerned about making workarounds with that kind of basic UI behaviors, specially if you are targeting more then one platform, which all of us probably do.
The team have any suggestion or any position about this issue?
Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.45
ios-deploy version: 1.9.0
ios-sim version: 5.0.10
OS: OS X El Capitan
Node Version: v4.4.0
Xcode version: Xcode 8.1 Build version 8B62
mhartington commentedon Jan 6, 2017
We have not been able to replicate this in our test. Can someone please open a new issue with all the required information on how to replicate
cmorbitzer commentedon Jan 31, 2017
I can only reproduce this in a private project. However, I was able to fix it by binding to the click event on
<ion-nav>in app.html. For example:<ion-nav [root]="rootPage" #content swipeBackEnabled="false" (click)="return"></ion-nav>I don't have the time to debug this myself now, but this suggests that there is a race condition of some sort causing this bug.
Ionic info:
peterpeterparker commentedon Mar 2, 2017
Same here. My workaround (I've got my input in a footer and nothing selectable in my content):
chr4ss1 commentedon Apr 2, 2017
Same here.
Repro here:
ionic start MyIonic2Project sidemenu --v2throw in a input in to the content:
clicking anywhere won't lose the focus on the input. so it's basically impossible to close it.
Ionic Info:
Your system information:
iPhone6
used the same work around as @cmorbitzer
knicholes commentedon Jun 13, 2017
Wait, seriously? This hasn't actually been fixed in the framework?
dylanvdmerwe commentedon Jun 13, 2017
There are a whole bunch of updates coming soon to ionic that deal with keyboard and inputs. Also, make sure to use the wkwebview plugin for iOS.
jorgemejia commentedon Jul 24, 2017
I used wkwebview plugin and it solves this issue but this plugin have an issue with the http request :( is there any solution for this ?
turigeza commentedon Jan 18, 2018
Has this got anything to do with Ionic ? This is a bug I find with safari on ios.
Once you focus on an input field or text field safari will not blur the element unless you click/touch another focusable element or you click the "Done" button on iphone or "keyboard close" button on ipad.
iOS 11.2.1 Phone
iOS 11.0.3 iPad
I would consider this a bug with iOS and safari but I would imagine in their eyes it is a feature : )
ionitron-bot commentedon Sep 1, 2018
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.