Skip to content

Commit cf68654

Browse files
committed
fix(tap): Remove 300ms delay when tapping select elements
1 parent b1d9ab8 commit cf68654

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

Diff for: js/ext/angular/test/service/ionicTap.unit.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ describe('Ionic Tap', function() {
9898
var targetEle = {
9999
dispatchEvent: function(clickEvent) {
100100
this.clickEvent = clickEvent;
101-
}
101+
},
102+
tagName: 'LABEL'
102103
};
103104
var e = { clientX: 99, clientY: 88 };
104105
ionic.tap.simulateClick(targetEle, e);

Diff for: js/utils/tap.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,7 @@
3434
// only climb up a max of 5 parents, anything more probably isn't beneficial
3535
if(!ele) break;
3636

37-
if( ele.tagName === "INPUT" ||
38-
ele.tagName === "A" ||
39-
ele.tagName === "BUTTON" ||
40-
ele.tagName === "LABEL" ||
41-
ele.tagName === "TEXTAREA" ) {
42-
37+
if( ele.tagName.match(/a|input|button|label|textarea|select/i) ) {
4338
return ionic.tap.simulateClick(ele, e);
4439
}
4540
ele = ele.parentElement;
@@ -73,9 +68,12 @@
7368

7469
ele.dispatchEvent(clickEvent);
7570

76-
if(ele.tagName === 'INPUT' || ele.tagName === 'TEXTAREA') {
71+
if( ele.tagName.match(/input|textarea/i) ) {
7772
ele.focus();
7873
e.preventDefault();
74+
} else if( ele.tagName == 'SELECT' ) {
75+
// select simulateClick should not preventDefault or else no options dialog
76+
ele.focus();
7977
} else {
8078
ionic.tap.blurActive();
8179
}

Diff for: test/html/input-select.html

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<title>Input: Select</title>
55
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
66
<link href="../../dist/css/ionic.css" rel="stylesheet">
7+
<script src="../../dist/js/ionic.bundle.js"></script>
78
</head>
89
<body>
910

0 commit comments

Comments
 (0)