From 02f309e16b8f0c8d577dbb28399ac013b23aca7f Mon Sep 17 00:00:00 2001 From: "justin.creasy@gmail.com" Date: Fri, 18 Aug 2017 11:19:08 -0400 Subject: [PATCH 1/3] enhanced tap event for web accessibility --- src/core.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index d268b34..caf8c6b 100644 --- a/src/core.js +++ b/src/core.js @@ -458,12 +458,19 @@ } }, tap: { - attach: ['pointerdown', 'pointerup'], + attach: ['pointerdown', 'pointerup', 'keypress'], condition: function(event, custom){ if (event.type == 'pointerdown') { custom.startX = event.clientX; custom.startY = event.clientY; } + else if (event.type == 'keypress') { + if (event.which == 13 || event.which == 32) { + return true; + } else { + return false; + } + } else if (event.button === 0 && Math.abs(custom.startX - event.clientX) < 10 && Math.abs(custom.startY - event.clientY) < 10) return true; From 6c4565dbbf82377dd96f1330fff0c952363ce991 Mon Sep 17 00:00:00 2001 From: "justin.creasy@gmail.com" Date: Thu, 24 Aug 2017 09:24:38 -0400 Subject: [PATCH 2/3] simplified code for tap event's web accessibility --- src/core.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/core.js b/src/core.js index caf8c6b..150750e 100644 --- a/src/core.js +++ b/src/core.js @@ -459,17 +459,13 @@ }, tap: { attach: ['pointerdown', 'pointerup', 'keypress'], - condition: function(event, custom){ + condition: function (event, custom) { if (event.type == 'pointerdown') { custom.startX = event.clientX; custom.startY = event.clientY; } else if (event.type == 'keypress') { - if (event.which == 13 || event.which == 32) { - return true; - } else { - return false; - } + return event.which == 13 || event.which == 32; } else if (event.button === 0 && Math.abs(custom.startX - event.clientX) < 10 && From 91b51c9f520a88e6f4df9913f4283c7845963fdb Mon Sep 17 00:00:00 2001 From: "justin.creasy@gmail.com" Date: Wed, 6 Sep 2017 16:07:35 -0400 Subject: [PATCH 3/3] Switched from KeyboardEvent.which (deprecated) to KeyboardEvent.key --- src/core.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core.js b/src/core.js index 150750e..cfb062a 100644 --- a/src/core.js +++ b/src/core.js @@ -465,7 +465,7 @@ custom.startY = event.clientY; } else if (event.type == 'keypress') { - return event.which == 13 || event.which == 32; + return event.key == "Enter" || event.key == " "; } else if (event.button === 0 && Math.abs(custom.startX - event.clientX) < 10 &&