a11y-dialog
Advanced tools
Comparing version 2.5.5 to 2.5.7
@@ -1,1 +0,2 @@ | ||
!function(e){"use strict";function t(e,t,n){function i(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}i.prototype=window.Event.prototype;var o;o=window.CustomEvent&&"function"==typeof window.CustomEvent?new window.CustomEvent(t,{detail:n}):new i(t,{bubbles:!1,cancelable:!1,detail:n}),o&&e.dispatchEvent(o)}function n(e){var t=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];return i(t.join(","),e).filter(function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)})}function i(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function o(e,t){var i=n(e),o=i.indexOf(document.activeElement);t.shiftKey&&0===o?(i[i.length-1].focus(),t.preventDefault()):t.shiftKey||o!==i.length-1||(i[0].focus(),t.preventDefault())}function d(e){var t=n(e);t.length&&t[0].focus()}var a,r=function(e,n){function r(t){l.shown&&27===t.which&&(t.preventDefault(),s()),l.shown&&9===t.which&&o(e,t)}function c(t){l.shown&&!e.contains(t.target)&&d(e)}function u(){l.shown||(l.shown=!0,e.removeAttribute("aria-hidden"),n.setAttribute("aria-hidden","true"),a=document.activeElement,d(e),document.body.addEventListener("focus",c,!0),document.addEventListener("keydown",r),t(e,"dialog:show",this))}function s(){l.shown&&(l.shown=!1,e.setAttribute("aria-hidden","true"),n.removeAttribute("aria-hidden"),a&&a.focus(),document.body.removeEventListener("focus",c,!0),document.removeEventListener("keydown",r),t(e,"dialog:hide",this))}function f(){s(),h.forEach(function(e){e.removeEventListener("click",u)}),v.forEach(function(e){e.removeEventListener("click",s)})}n=n||document.querySelector("#main");var l=this,h=i('[data-a11y-dialog-show="'+e.id+'"]'),v=i("[data-a11y-dialog-hide]",e).concat(i('[data-a11y-dialog-hide="'+e.id+'"]'));e.hasAttribute("aria-hidden")&&(this.shown=!JSON.parse(e.getAttribute("aria-hidden"))),this.show=u,this.hide=s,this.destroy=f,h.forEach(function(e){e.addEventListener("click",u)}),v.forEach(function(e){e.addEventListener("click",s)})};"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=r:"function"==typeof define&&define.amd?define("A11yDialog",[],function(){return r}):"object"==typeof e&&(e.A11yDialog=r)}(this); | ||
/*! a11y-dialog 2.5.7 — © Edenspiekermann */ | ||
!function(e){"use strict";function t(e,t,n){function i(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}i.prototype=window.Event.prototype;var o;o=window.CustomEvent&&"function"==typeof window.CustomEvent?new window.CustomEvent(t,{detail:n}):new i(t,{bubbles:!1,cancelable:!1,detail:n}),o&&e.dispatchEvent(o)}function n(e){var t=["a[href]","area[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])","iframe","object","embed","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];return i(t.join(","),e).filter(function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)})}function i(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function o(e,t){var i=n(e),o=i.indexOf(document.activeElement);t.shiftKey&&0===o?(i[i.length-1].focus(),t.preventDefault()):t.shiftKey||o!==i.length-1||(i[0].focus(),t.preventDefault())}function d(e){var t=n(e);t.length&&t[0].focus()}var a,r=function(e,n){function r(t){l.shown&&27===t.which&&(t.preventDefault(),s()),l.shown&&9===t.which&&o(e,t)}function c(t){l.shown&&!e.contains(t.target)&&d(e)}function u(){l.shown||(l.shown=!0,e.removeAttribute("aria-hidden"),n.setAttribute("aria-hidden","true"),a=document.activeElement,d(e),document.body.addEventListener("focus",c,!0),document.addEventListener("keydown",r),t(e,"dialog:show",this))}function s(){l.shown&&(l.shown=!1,e.setAttribute("aria-hidden","true"),n.removeAttribute("aria-hidden"),a&&a.focus(),document.body.removeEventListener("focus",c,!0),document.removeEventListener("keydown",r),t(e,"dialog:hide",this))}function f(){s(),h.forEach(function(e){e.removeEventListener("click",u)}),v.forEach(function(e){e.removeEventListener("click",s)})}n=n||document.querySelector("#main");var l=this,h=i('[data-a11y-dialog-show="'+e.id+'"]'),v=i("[data-a11y-dialog-hide]",e).concat(i('[data-a11y-dialog-hide="'+e.id+'"]'));e.hasAttribute("aria-hidden")&&(this.shown=!JSON.parse(e.getAttribute("aria-hidden"))),this.show=u,this.hide=s,this.destroy=f,h.forEach(function(e){e.addEventListener("click",u)}),v.forEach(function(e){e.addEventListener("click",s)})};"undefined"!=typeof module&&"undefined"!=typeof module.exports?module.exports=r:"function"==typeof define&&define.amd?define("A11yDialog",[],function(){return r}):"object"==typeof e&&(e.A11yDialog=r)}(this); |
{ | ||
"name": "a11y-dialog", | ||
"version": "2.5.5", | ||
"version": "2.5.7", | ||
"description": "A tiny script to make dialog windows accessible to assistive technology users.", | ||
@@ -23,6 +23,9 @@ "homepage": "https://github.com/edenspiekermann/a11y-dialog", | ||
"build": "npm run minify && npm run copy", | ||
"postbuild": "npm run add-version", | ||
"predeploy": "npm run build", | ||
"deploy": "git subtree push --prefix example origin gh-pages", | ||
"lint": "semistandard a11y-dialog.js", | ||
"test": "open tests/index.html" | ||
"test": "open tests/index.html", | ||
"extract-version": "cat package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]'", | ||
"add-version": "echo \"/*! a11y-dialog $(npm run extract-version --silent) — © Edenspiekermann */\n$(cat a11y-dialog.min.js)\" > a11y-dialog.min.js" | ||
}, | ||
@@ -29,0 +32,0 @@ "devDependencies": { |
@@ -119,3 +119,3 @@ # A11y Dialog | ||
// Get the dialog element (with the accessor method you want) | ||
var dialogEl = document.getElementById('my-awesome-dialog'); | ||
var dialogEl = document.getElementById('my-accessible-dialog'); | ||
@@ -136,6 +136,6 @@ // Instanciate a new A11yDialog module | ||
The following button will open the dialog with the `my-awesome-dialog` id when interacted with. | ||
The following button will open the dialog with the `my-accessible-dialog` id when interacted with. | ||
```html | ||
<button type="button" data-a11y-dialog-show="my-awesome-dialog">Open the dialog</button> | ||
<button type="button" data-a11y-dialog-show="my-accessible-dialog">Open the dialog</button> | ||
``` | ||
@@ -149,6 +149,6 @@ | ||
The following button will close the dialog with the `my-awesome-dialog` id when interacted with. Given that the only focusable elements when the dialog is open are the focusable children of the dialog itself, it seems rather unlikely that you will ever need this but in case you do, well you can. | ||
The following button will close the dialog with the `my-accessible-dialog` id when interacted with. Given that the only focusable elements when the dialog is open are the focusable children of the dialog itself, it seems rather unlikely that you will ever need this but in case you do, well you can. | ||
```html | ||
<button type="button" data-a11y-dialog-hide="my-awesome-dialog" aria-label="Close the dialog">×</button> | ||
<button type="button" data-a11y-dialog-hide="my-accessible-dialog" aria-label="Close the dialog">×</button> | ||
``` | ||
@@ -155,0 +155,0 @@ |
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
17382
140