Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/scottaohara/aria_buttons
Make role="button" elements listen for Space & Enter Keypresses
https://github.com/scottaohara/aria_buttons
a11y accessibility aria button
Last synced: 26 days ago
JSON representation
Make role="button" elements listen for Space & Enter Keypresses
- Host: GitHub
- URL: https://github.com/scottaohara/aria_buttons
- Owner: scottaohara
- License: mit
- Created: 2016-11-26T13:47:09.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2022-02-19T21:25:04.000Z (over 2 years ago)
- Last Synced: 2024-10-06T16:35:17.584Z (about 1 month ago)
- Topics: a11y, accessibility, aria, button
- Language: HTML
- Homepage: https://scottaohara.github.io/aria_buttons/
- Size: 32.2 KB
- Stars: 7
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# ARIA Buttons
This script largely serves as a demonstration of a way to ensure that elements with `role=button` can be activated using Space and Enter keys. It makes sure that if a `role=button` has an `aria-disabled=true`, then it will _not_ be keyboard focusable. Finally, if the script detects an `aria-pressed` attribute, it will assign a function specifically to toggle the value of the attribute.## Why do you need this?
As long as you're setting up `role="button"` elements to work with the appropriate keyboard controls in your own scripts, then you likely don't need this.
If you are using native HTML ``s, then you also likely don't need this.In general, you likely don't need this. Just use a `` and manage your own `aria-pressed` :)
## License & Such
This script was written by [Scott O'Hara](https://twitter.com/scottohara).It has an [MIT license](https://github.com/scottaohara/accessible-components/blob/master/LICENSE.md).