fix(tap): Remove 300ms delay when tapping select elements

This commit is contained in:
Adam Bradley
2014-04-05 23:43:12 -05:00
parent b1d9ab84f4
commit cf686548da
3 changed files with 8 additions and 8 deletions

View File

@@ -98,7 +98,8 @@ describe('Ionic Tap', function() {
var targetEle = {
dispatchEvent: function(clickEvent) {
this.clickEvent = clickEvent;
}
},
tagName: 'LABEL'
};
var e = { clientX: 99, clientY: 88 };
ionic.tap.simulateClick(targetEle, e);

View File

@@ -34,12 +34,7 @@
// only climb up a max of 5 parents, anything more probably isn't beneficial
if(!ele) break;
if( ele.tagName === "INPUT" ||
ele.tagName === "A" ||
ele.tagName === "BUTTON" ||
ele.tagName === "LABEL" ||
ele.tagName === "TEXTAREA" ) {
if( ele.tagName.match(/a|input|button|label|textarea|select/i) ) {
return ionic.tap.simulateClick(ele, e);
}
ele = ele.parentElement;
@@ -73,9 +68,12 @@
ele.dispatchEvent(clickEvent);
if(ele.tagName === 'INPUT' || ele.tagName === 'TEXTAREA') {
if( ele.tagName.match(/input|textarea/i) ) {
ele.focus();
e.preventDefault();
} else if( ele.tagName == 'SELECT' ) {
// select simulateClick should not preventDefault or else no options dialog
ele.focus();
} else {
ionic.tap.blurActive();
}

View File

@@ -4,6 +4,7 @@
<title>Input: Select</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link href="../../dist/css/ionic.css" rel="stylesheet">
<script src="../../dist/js/ionic.bundle.js"></script>
</head>
<body>