a11y-dialog
Advanced tools
Comparing version 2.5.0 to 2.5.1
@@ -77,3 +77,6 @@ (function (global) { | ||
this.shown = false; | ||
if (this.hasAttribute('aria-hidden')) { | ||
this.shown = !JSON.parse(this.getAttribute('aria-hidden')); | ||
} | ||
this.show = show; | ||
@@ -80,0 +83,0 @@ this.hide = hide; |
@@ -1,1 +0,1 @@ | ||
!function(e){"use strict";function t(t,n,o){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=e.Event.prototype;var a;a=e.CustomEvent&&"function"==typeof e.CustomEvent?new e.CustomEvent(n,{detail:o}):new i(n,{bubbles:!1,cancelable:!1,detail:o}),a&&t.dispatchEvent(a)}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 o(t.join(","),e).filter(function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)})}function o(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function i(e,t){var o=n(e),i=o.indexOf(document.activeElement);t.shiftKey&&0===i?(o[o.length-1].focus(),t.preventDefault()):t.shiftKey||i!==o.length-1||(o[0].focus(),t.preventDefault())}function a(e){var t=n(e);t.length&&t[0].focus()}var d,c=function(e,n){function c(t){l.shown&&27===t.which&&(t.preventDefault(),s()),l.shown&&9===t.which&&i(e,t)}function r(t){l.shown&&!e.contains(t.target)&&a(e)}function u(){l.shown=!0,e.removeAttribute("aria-hidden"),n.setAttribute("aria-hidden","true"),d=document.activeElement,a(e),document.body.addEventListener("focus",r,!0),document.addEventListener("keydown",c),t(e,"dialog:show",this)}function s(){l.shown=!1,e.setAttribute("aria-hidden","true"),n.removeAttribute("aria-hidden"),d&&d.focus(),document.body.removeEventListener("focus",r,!0),document.removeEventListener("keydown",c),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=o('[data-a11y-dialog-show="'+e.id+'"]'),v=o("[data-a11y-dialog-hide]",e).concat(o('[data-a11y-dialog-hide="'+e.id+'"]'));this.shown=!1,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=c:"function"==typeof define&&define.amd?define("A11yDialog",[],function(){return c}):"object"==typeof e&&(e.A11yDialog=c)}(window); | ||
!function(e){"use strict";function t(t,n,i){function o(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}o.prototype=e.Event.prototype;var a;a=e.CustomEvent&&"function"==typeof e.CustomEvent?new e.CustomEvent(n,{detail:i}):new o(n,{bubbles:!1,cancelable:!1,detail:i}),a&&t.dispatchEvent(a)}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 a(e){var t=n(e);t.length&&t[0].focus()}var d,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)&&a(e)}function u(){l.shown=!0,e.removeAttribute("aria-hidden"),n.setAttribute("aria-hidden","true"),d=document.activeElement,a(e),document.body.addEventListener("focus",c,!0),document.addEventListener("keydown",r),t(e,"dialog:show",this)}function s(){l.shown=!1,e.setAttribute("aria-hidden","true"),n.removeAttribute("aria-hidden"),d&&d.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+'"]'));this.hasAttribute("aria-hidden")&&(this.shown=!JSON.parse(this.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)}(window); |
{ | ||
"name": "a11y-dialog", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "A tiny script to make dialog windows accessible to assistive technology users.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/edenspiekermann/a11y-dialog", |
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
16893
127