Enhance tap event for web accessibility#178
Enhance tap event for web accessibility#178JustinCreasy wants to merge 3 commits intox-tag:masterfrom
Conversation
src/core.js
Outdated
| custom.startY = event.clientY; | ||
| } | ||
| else if (event.type == 'keypress') { | ||
| if (event.which == 13 || event.which == 32) { |
There was a problem hiding this comment.
Consider simplifying to: return event.which == 13 || event.which == 32;
|
KeyboardEvent.which is now deprecated. May want to switch to `event.key`,
or use in addition to `event.which`.
https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/which
…On Thu, Aug 24, 2017 at 9:25 AM, JustinCreasy ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In src/core.js
<#178 (comment)>:
> 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) {
thanks, great suggestion.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#178 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AQpkk5OQapO36EKDlmLhia3R7EgBFLiVks5sbXnTgaJpZM4O7tCF>
.
|
|
Per @jpecor-pmi's correct assertion about the deprecation of Also, can you do the same thing in the core-2 repo when we release the alpha this week? |
|
That works, I'll get either event.which or event.key worked in there. A bit swamped at work at the moment but hopefully soon. I can definitely make the updates again on core-2. |
|
It looks like |
|
ok, I have switched to KeyboardEvent.key, as suggested by @jpecor-pmi I'm a bit concerned because while KeyboardEvent.which is deprecated it has much better support in older browsers than KeyboardEvent.key ( according to http://caniuse.com ). When I get a chance I'll try to test things on a virtual machine running a browser like Chrome v49 to see if I can work up a solution that uses both. |
The tap event as it works now is not fully accessible. This PR add a keypress check for the enter key and the spacebar and treats them as tap events as well.