Skip to content

Commit 80640c8

Browse files
authored
Merge pull request #3971 from Polymer/voiceover-click
Make sure click events can always trigger tap, even on touch only devices
2 parents e45eeff + 02441ca commit 80640c8

File tree

2 files changed

+54
-6
lines changed

2 files changed

+54
-6
lines changed

src/standard/gestures.html

+4-6
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,9 @@
7171
};
7272

7373
function setupTeardownMouseCanceller(setup) {
74-
for (var i = 0, en; i < MOUSE_EVENTS.length; i++) {
75-
en = MOUSE_EVENTS[i];
74+
var events = IS_TOUCH_ONLY ? ['click'] : MOUSE_EVENTS;
75+
for (var i = 0, en; i < events.length; i++) {
76+
en = events[i];
7677
if (setup) {
7778
document.addEventListener(en, mouseCanceller, true);
7879
} else {
@@ -82,9 +83,6 @@
8283
}
8384

8485
function ignoreMouse() {
85-
if (IS_TOUCH_ONLY) {
86-
return;
87-
}
8886
if (!POINTERSTATE.mouse.mouseIgnoreJob) {
8987
setupTeardownMouseCanceller(true);
9088
}
@@ -318,7 +316,7 @@
318316
for (var i = 0, dep, gd; i < deps.length; i++) {
319317
dep = deps[i];
320318
// don't add mouse handlers on iOS because they cause gray selection overlays
321-
if (IS_TOUCH_ONLY && MOUSE_EVENTS.indexOf(dep) > -1) {
319+
if (IS_TOUCH_ONLY && MOUSE_EVENTS.indexOf(dep) > -1 && dep !== 'click') {
322320
continue;
323321
}
324322
gd = gobj[dep];

test/smoke/ios-voiceover.html

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!DOCTYPE html>
2+
<!--
3+
@license
4+
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
5+
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
6+
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
7+
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
8+
Code distributed by Google as part of the polymer project is also
9+
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
10+
-->
11+
<html>
12+
<head>
13+
<meta charset="utf-8">
14+
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
15+
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes">
16+
<script src="../../../webcomponentsjs/webcomponents.js"></script>
17+
18+
<link rel="import" href="../../polymer.html">
19+
20+
<title>Polymer</title>
21+
22+
</head>
23+
<body>
24+
<dom-module id="link-tap">
25+
<template>
26+
<style>
27+
a {
28+
font-size: 12em;
29+
display: block;
30+
}
31+
</style>
32+
<a id="normal" href="javascript:void(0)" on-tap="logTap">
33+
normal
34+
</a>
35+
<pre id="pre"></pre>
36+
</template>
37+
<script>
38+
HTMLImports.whenReady(function() {
39+
Polymer({
40+
is: 'link-tap',
41+
logTap: function() {
42+
this.$.pre.textContent += 'tap ' + performance.now() + '\n';
43+
}
44+
});
45+
});
46+
</script>
47+
</dom-module>
48+
<link-tap></link-tap>
49+
</body>
50+
</html>

0 commit comments

Comments
 (0)