a11y-dialog
Advanced tools
Comparing version 2.0.0 to 2.0.2
@@ -15,3 +15,3 @@ (function (global) { | ||
function $$ (selector, context) { | ||
return Array.prototype.slice.call((context || document).querySelectorAll(selector) || []); | ||
return Array.prototype.slice.call((context || document).querySelectorAll(selector)); | ||
} | ||
@@ -74,7 +74,7 @@ | ||
document.body.addEventListener('focus', function (event) { | ||
function maintainFocus (event) { | ||
if (that.shown && !node.contains(event.target)) { | ||
setFocusToFirstItem(node); | ||
} | ||
}, true); | ||
} | ||
@@ -87,2 +87,3 @@ function show () { | ||
setFocusToFirstItem(node); | ||
document.body.addEventListener('focus', maintainFocus, true); | ||
} | ||
@@ -95,2 +96,3 @@ | ||
focusedBeforeDialog.focus(); | ||
document.body.removeEventListener('focus', maintainFocus, true); | ||
} | ||
@@ -97,0 +99,0 @@ }; |
{ | ||
"name": "a11y-dialog", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"description": "A tiny script to make dialog windows accessible to assistive technology users.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/edenspiekermann/a11y-dialog", |
# A11y Dialog | ||
This repository is a fork from [accessible-modal-dialog](https://github.com/gdkraus/accessible-modal-dialog) by [Greg Kraus](https://github.com/gdkraus). We at [Edenspiekermann](http://edenspiekermann.com) are big fans of the original version, although we discovered we could improve it and make it even better. On top of that, the original script depends on jQuery, which happened to be a problem for us. | ||
This repository is a fork from [accessible-modal-dialog](https://github.com/gdkraus/a11y-dialog) by [Greg Kraus](https://github.com/gdkraus). We at [Edenspiekermann](http://edenspiekermann.com) are big fans of the original version, although we discovered we could improve it and make it even better. On top of that, the original script depends on jQuery, which happened to be a problem for us. | ||
The original repository being apparently unmaintained, we decided to fork it and release our own version of the accessible modal dialog. All credits to the original author. | ||
You can try the [live demo](http://edenspiekermann.github.io/accessible-modal-dialog/). | ||
You can try the [live demo](http://edenspiekermann.github.io/a11y-dialog/). | ||
![CodeShip test status](https://codeship.com/projects/7dd06120-b6f8-0133-792c-265d84c132f8/status?branch=master) | ||
## What’s new in Edenspiekermann’s version? | ||
## Nice things to know | ||
- No more dependency (not even jQuery); | ||
- No dependency (not even jQuery); | ||
- Possibility to have several different dialog windows on the page; | ||
- DOM API for dialog openers (`data-a11y-dialog-show="dialog-id"`) and closers (`data-a11y-dialog-hide`); | ||
- JS API to manually show and hide dialog windows as well as knowing their status (`dialog.show()`, `dialog.hide()`, `dialog.shown`); | ||
- Addition of `[tabindex]:not([value="-1"])` to focusable elements; | ||
- No more `display` manipulation in JS, the hiding mechanism is entirely up to the CSS layer (using `[aria-hidden]` selectors); | ||
- DOM API (`data-a11y-dialog-show="dialog-id"`, `data-a11y-dialog-hide`); | ||
- JS API (`dialog.show()`, `dialog.hide()`, `dialog.shown`); | ||
- No `display` manipulation in JS, the hiding mechanism is entirely up to the CSS layer (using `[aria-hidden]` selectors); | ||
- Full test coverage with [CasperJS](http://casperjs.org) and [CodeShip](https://codeship.com); | ||
- Cleaner code resulting in only 650 bytes (0.65Kb!) once gzipped. | ||
- Clean code resulting in only 650 bytes (0.65Kb!) once gzipped. | ||
@@ -30,2 +29,6 @@ *Note: the script should run seamlessly in Internet Explorer 9 and above.* | ||
``` | ||
bower install espi-a11y-dialog | ||
``` | ||
Or you could also copy/paste the script in your project directly, but you will be disconnected from this repository, making it hard for your to get updates. | ||
@@ -35,3 +38,3 @@ | ||
You will find a concrete demo in the [example](https://github.com/edenspiekermann/accessible-modal-dialog/tree/master/example) folder of this repository, but basically here is the gist: | ||
You will find a concrete demo in the [example](https://github.com/edenspiekermann/a11y-dialog/tree/master/example) folder of this repository, but basically here is the gist: | ||
@@ -164,3 +167,3 @@ ### HTML | ||
The [example page](http://edenspiekermann.github.io/accessible-modal-dialog/) is deployed through [GitHub Pages](https://pages.github.com/). | ||
The [example page](http://edenspiekermann.github.io/a11y-dialog/) is deployed through [GitHub Pages](https://pages.github.com/). | ||
@@ -167,0 +170,0 @@ ``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-permissive License
License(Experimental) A license not known to be considered permissive was found.
Found 1 instance in 1 package
0
100
81
170
11628