Skip to content

Easily handle keyboard click events on non semantic button elements.

License

Notifications You must be signed in to change notification settings

svinkle/a11yclick

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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" by Karl Groves.

The script weighs in at 20 bytes gzipped and has no dependencies.

Installation

Install with Bower:

bower install --save a11yclick

Add a script tag at the bottom of the page, before your application logic.

<script src="a11yclick.js"></script>
<script src="app.js"></script>

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.

$('#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.

About

Easily handle keyboard click events on non semantic button elements.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published