Created
September 15, 2015 15:08
-
-
Save juice49/2638bba62368812a4705 to your computer and use it in GitHub Desktop.
Buttons for non-buttons
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const $ = require('jquery'); | |
const keycode = require('keycode'); | |
$('[role=button]').on('keydown', function(e) { | |
if(keycode(e) === 'space') { | |
e.preventDefault(); | |
$(this).trigger('click'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment