Only trigger clear/cancel buttons on certain keys

It’s annoying having these buttons triggered by the tab or command keys.
This commit is contained in:
Chris Hill-Scott
2018-12-10 17:32:36 +00:00
parent 0c71ca0f0e
commit ce86604a49

View File

@@ -74,8 +74,11 @@
.addClass('js-cancel')
.attr('tabindex', '0')
.on('click keydown', event => {
event.preventDefault();
fn();
// space, enter or no keyCode (must be mouse input)
if ([13, 32, undefined].indexOf(event.keyCode) > -1) {
event.preventDefault();
fn();
}
});
this.selectActionButtons = function () {