mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
blur active input w/ setTimeout
This commit is contained in:
@@ -47,8 +47,9 @@
|
||||
|
||||
if(ele.tagName === 'INPUT' || ele.tagName === 'TEXTAREA' || ele.tagName === 'SELECT') {
|
||||
ele.focus();
|
||||
e.preventDefault();
|
||||
} else {
|
||||
ele.blur();
|
||||
blurActive();
|
||||
}
|
||||
|
||||
// remember the coordinates of this tap so if it happens again we can ignore it
|
||||
@@ -103,12 +104,7 @@
|
||||
// they didn't tap one of the above elements
|
||||
// if the currently active element is an input, and they tapped outside
|
||||
// of the current input, then unset its focus (blur) so the keyboard goes away
|
||||
ele = document.activeElement;
|
||||
if(ele && (ele.tagName === "INPUT" ||
|
||||
ele.tagName === "TEXTAREA" ||
|
||||
ele.tagName === "SELECT")) {
|
||||
ele.blur();
|
||||
}
|
||||
blurActive();
|
||||
}
|
||||
|
||||
function preventGhostClick(e) {
|
||||
@@ -159,6 +155,18 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
function blurActive() {
|
||||
var ele = document.activeElement;
|
||||
if(ele && (ele.tagName === "INPUT" ||
|
||||
ele.tagName === "TEXTAREA" ||
|
||||
ele.tagName === "SELECT")) {
|
||||
// using a timeout to prevent funky scrolling while a keyboard hides
|
||||
setTimeout(function(){
|
||||
ele.blur();
|
||||
}, 400);
|
||||
}
|
||||
}
|
||||
|
||||
function isRecentTap(event) {
|
||||
// loop through the tap coordinates and see if the same area has been tapped recently
|
||||
var tapId, existingCoordinates, currentCoordinates,
|
||||
|
||||
Reference in New Issue
Block a user