https://github.com/svinkle/a11yclick
Easily handle keyboard click events on non semantic button elements.
https://github.com/svinkle/a11yclick
Last synced: over 1 year ago
JSON representation
Easily handle keyboard click events on non semantic button elements.
- Host: GitHub
- URL: https://github.com/svinkle/a11yclick
- Owner: svinkle
- License: mit
- Created: 2014-12-31T00:25:36.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2019-01-13T16:56:14.000Z (over 7 years ago)
- Last Synced: 2025-02-23T23:06:14.830Z (over 1 year ago)
- Language: HTML
- Size: 6.84 KB
- Stars: 10
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# a11yclick
Easily handle keyboard click events on non semantic button elements.
This is a fork from the blog post entitled "[Ridiculously easy trick for keyboard accessibility](http://www.karlgroves.com/2014/11/24/ridiculously-easy-trick-for-keyboard-accessibility/)" by Karl Groves.
The script weighs in at 20 bytes gzipped and has no dependencies.
## Installation
Install with [Bower](http://bower.io):
```
bower install --save a11yclick
```
Add a ```script``` tag at the bottom of the page, before your application logic.
```html
```
## Usage
Wrap the event logic with a conditional statement, checking the return value of the a11yclick() function. Make sure to pass in the event object.
```javascript
$('#fake-button').on('click keydown', function(event) {
if (a11yClick(event)) {
// Event logic
}
});
```
## Browser support
* Google Chrome (latest)
* Opera (latest)
* Firefox 4+
* Safari 5+
* Internet Explorer 7+
## License
This project and its source code is licensed under the [MIT](LICENSE.txt) license.