a11y-dialog
Advanced tools
Comparing version 8.1.0 to 8.1.1
@@ -381,12 +381,15 @@ const not = { | ||
const target = event.composedPath()[0]; | ||
// We use `.closest(..)` and not `.matches(..)` here so that clicking | ||
// an element nested within a dialog opener does cause the dialog to open | ||
if (target.closest(`[${SCOPE}-show="${this.id}"]`)) { | ||
const opener = closest(`[${SCOPE}-show="${this.id}"]`, target); | ||
const explicitCloser = closest(`[${SCOPE}-hide="${this.id}"]`, target); | ||
const implicitCloser = closest(`[${SCOPE}-hide]`, target) && | ||
closest('[aria-modal="true"]', target) === this.$el; | ||
// We use `closest(..)` (instead of `matches(..)`) so that clicking an | ||
// element nested within a dialog opener does cause the dialog to open, and | ||
// we use our custom `closest(..)` function so that it can cross shadow | ||
// boundaries | ||
// See: https://github.com/KittyGiraudel/a11y-dialog/issues/712 | ||
if (opener) | ||
this.show(event); | ||
} | ||
if (target.closest(`[${SCOPE}-hide="${this.id}"]`) || | ||
(target.closest(`[${SCOPE}-hide]`) && | ||
target.closest('[aria-modal="true"]') === this.$el)) { | ||
if (explicitCloser || implicitCloser) | ||
this.hide(event); | ||
} | ||
} | ||
@@ -393,0 +396,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
/*! a11y-dialog 8.1.0 — © Kitty Giraudel */ | ||
const t=":not([inert]):not([inert] *)",e=':not([tabindex^="-"])',i=":not(:disabled)";var s=[`a[href]${t}${e}`,`area[href]${t}${e}`,`input:not([type="hidden"]):not([type="radio"])${t}${e}${i}`,`input[type="radio"]${t}${e}${i}`,`select${t}${e}${i}`,`textarea${t}${e}${i}`,`button${t}${e}${i}`,`details${t} > summary:first-of-type${e}`,`iframe${t}${e}`,`audio[controls]${t}${e}`,`video[controls]${t}${e}`,`[contenteditable]${t}${e}`,`[tabindex]${t}${e}`];function n(t){(t.querySelector("[autofocus]")||t).focus()}function o(t,e){if(e&&h(t))return t;if(function(t){return(!t.shadowRoot||"-1"!==t.getAttribute("tabindex"))&&!t.matches(":disabled,[hidden],[inert]")}(t))if(t.shadowRoot){let i=r(t.shadowRoot,e);for(;i;){const t=o(i,e);if(t)return t;i=d(i,e)}}else if("slot"===t.localName){const i=t.assignedElements({flatten:!0});e||i.reverse();for(const t of i){const i=o(t,e);if(i)return i}}else{let i=r(t,e);for(;i;){const t=o(i,e);if(t)return t;i=d(i,e)}}return!e&&h(t)?t:null}function r(t,e){return e?t.firstElementChild:t.lastElementChild}function d(t,e){return e?t.nextElementSibling:t.previousElementSibling}const h=t=>!t.shadowRoot?.delegatesFocus&&(t.matches(s.join(","))&&!(t=>!(!t.matches("details:not([open]) *")||t.matches("details>summary:first-of-type"))||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))(t));function a(t=document){const e=t.activeElement;return e?e.shadowRoot?a(e.shadowRoot)||document.activeElement:e:null}function l(t,e){const[i,s]=function(t){const e=o(t,!0);return[e,e?o(t,!1)||e:null]}(t);if(!i)return e.preventDefault();const n=a();e.shiftKey&&n===i?(s.focus(),e.preventDefault()):e.shiftKey||n!==s||(i.focus(),e.preventDefault())}const u="data-a11y-dialog";class c{$el;id;previouslyFocused;shown;constructor(t){this.$el=t,this.id=this.$el.getAttribute(u)||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.fire("destroy").defaultPrevented||(this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0))),this}show(t){if(this.shown)return this;return this.fire("show",t).defaultPrevented||(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=a(),"BODY"===this.previouslyFocused?.tagName&&t?.target&&(this.previouslyFocused=t.target),"focus"===t?.type?this.maintainFocus(t):n(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0)),this}hide(t){if(!this.shown)return this;return this.fire("hide",t).defaultPrevented||(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this.previouslyFocused?.focus?.(),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0)),this}on(t,e,i){return this.$el.addEventListener(t,e,i),this}off(t,e,i){return this.$el.removeEventListener(t,e,i),this}fire(t,e){const i=new CustomEvent(t,{detail:e,cancelable:!0});return this.$el.dispatchEvent(i),i}handleTriggerClicks(t){const e=t.composedPath()[0];e.closest(`[${u}-show="${this.id}"]`)&&this.show(t),(e.closest(`[${u}-hide="${this.id}"]`)||e.closest(`[${u}-hide]`)&&e.closest('[aria-modal="true"]')===this.$el)&&this.hide(t)}bindKeypress(t){if(e='[aria-modal="true"]',function t(i){return i&&i!==document&&i!==window?(i.assignedSlot&&(i=i.assignedSlot),i.closest(e)||t(i.getRootNode().host)):null}(a())!==this.$el)return;var e;let i=!1;try{i=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}"Escape"!==t.key||"alertdialog"===this.$el.getAttribute("role")||i||(t.preventDefault(),this.hide(t)),"Tab"===t.key&&l(this.$el,t)}maintainFocus(t){t.target.closest(`[aria-modal="true"], [${u}-ignore-focus-trap]`)||n(this.$el)}}function f(){for(const t of document.querySelectorAll("[data-a11y-dialog]"))new c(t)}"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",f):f());export{c as default}; | ||
/*! a11y-dialog 8.1.1 — © Kitty Giraudel */ | ||
const t=":not([inert]):not([inert] *)",e=':not([tabindex^="-"])',i=":not(:disabled)";var s=[`a[href]${t}${e}`,`area[href]${t}${e}`,`input:not([type="hidden"]):not([type="radio"])${t}${e}${i}`,`input[type="radio"]${t}${e}${i}`,`select${t}${e}${i}`,`textarea${t}${e}${i}`,`button${t}${e}${i}`,`details${t} > summary:first-of-type${e}`,`iframe${t}${e}`,`audio[controls]${t}${e}`,`video[controls]${t}${e}`,`[contenteditable]${t}${e}`,`[tabindex]${t}${e}`];function n(t){(t.querySelector("[autofocus]")||t).focus()}function o(t,e){if(e&&h(t))return t;if(function(t){return(!t.shadowRoot||"-1"!==t.getAttribute("tabindex"))&&!t.matches(":disabled,[hidden],[inert]")}(t))if(t.shadowRoot){let i=r(t.shadowRoot,e);for(;i;){const t=o(i,e);if(t)return t;i=d(i,e)}}else if("slot"===t.localName){const i=t.assignedElements({flatten:!0});e||i.reverse();for(const t of i){const i=o(t,e);if(i)return i}}else{let i=r(t,e);for(;i;){const t=o(i,e);if(t)return t;i=d(i,e)}}return!e&&h(t)?t:null}function r(t,e){return e?t.firstElementChild:t.lastElementChild}function d(t,e){return e?t.nextElementSibling:t.previousElementSibling}const h=t=>!t.shadowRoot?.delegatesFocus&&(t.matches(s.join(","))&&!(t=>!(!t.matches("details:not([open]) *")||t.matches("details>summary:first-of-type"))||!(t.offsetWidth||t.offsetHeight||t.getClientRects().length))(t));function a(t=document){const e=t.activeElement;return e?e.shadowRoot?a(e.shadowRoot)||document.activeElement:e:null}function l(t,e){const[i,s]=function(t){const e=o(t,!0);return[e,e?o(t,!1)||e:null]}(t);if(!i)return e.preventDefault();const n=a();e.shiftKey&&n===i?(s.focus(),e.preventDefault()):e.shiftKey||n!==s||(i.focus(),e.preventDefault())}function u(t,e){return function e(i){return i&&i!==document&&i!==window?(i.assignedSlot&&(i=i.assignedSlot),i.closest(t)||e(i.getRootNode().host)):null}(e)}const c="data-a11y-dialog";class f{$el;id;previouslyFocused;shown;constructor(t){this.$el=t,this.id=this.$el.getAttribute(c)||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.fire("destroy").defaultPrevented||(this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0))),this}show(t){if(this.shown)return this;return this.fire("show",t).defaultPrevented||(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=a(),"BODY"===this.previouslyFocused?.tagName&&t?.target&&(this.previouslyFocused=t.target),"focus"===t?.type?this.maintainFocus(t):n(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0)),this}hide(t){if(!this.shown)return this;return this.fire("hide",t).defaultPrevented||(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this.previouslyFocused?.focus?.(),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0)),this}on(t,e,i){return this.$el.addEventListener(t,e,i),this}off(t,e,i){return this.$el.removeEventListener(t,e,i),this}fire(t,e){const i=new CustomEvent(t,{detail:e,cancelable:!0});return this.$el.dispatchEvent(i),i}handleTriggerClicks(t){const e=t.composedPath()[0],i=u(`[${c}-show="${this.id}"]`,e),s=u(`[${c}-hide="${this.id}"]`,e),n=u(`[${c}-hide]`,e)&&u('[aria-modal="true"]',e)===this.$el;i&&this.show(t),(s||n)&&this.hide(t)}bindKeypress(t){if(u('[aria-modal="true"]',a())!==this.$el)return;let e=!1;try{e=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}"Escape"!==t.key||"alertdialog"===this.$el.getAttribute("role")||e||(t.preventDefault(),this.hide(t)),"Tab"===t.key&&l(this.$el,t)}maintainFocus(t){t.target.closest(`[aria-modal="true"], [${c}-ignore-focus-trap]`)||n(this.$el)}}function $(){for(const t of document.querySelectorAll("[data-a11y-dialog]"))new f(t)}"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",$):$());export{f as default}; |
@@ -387,12 +387,15 @@ (function (global, factory) { | ||
const target = event.composedPath()[0]; | ||
// We use `.closest(..)` and not `.matches(..)` here so that clicking | ||
// an element nested within a dialog opener does cause the dialog to open | ||
if (target.closest(`[${SCOPE}-show="${this.id}"]`)) { | ||
const opener = closest(`[${SCOPE}-show="${this.id}"]`, target); | ||
const explicitCloser = closest(`[${SCOPE}-hide="${this.id}"]`, target); | ||
const implicitCloser = closest(`[${SCOPE}-hide]`, target) && | ||
closest('[aria-modal="true"]', target) === this.$el; | ||
// We use `closest(..)` (instead of `matches(..)`) so that clicking an | ||
// element nested within a dialog opener does cause the dialog to open, and | ||
// we use our custom `closest(..)` function so that it can cross shadow | ||
// boundaries | ||
// See: https://github.com/KittyGiraudel/a11y-dialog/issues/712 | ||
if (opener) | ||
this.show(event); | ||
} | ||
if (target.closest(`[${SCOPE}-hide="${this.id}"]`) || | ||
(target.closest(`[${SCOPE}-hide]`) && | ||
target.closest('[aria-modal="true"]') === this.$el)) { | ||
if (explicitCloser || implicitCloser) | ||
this.hide(event); | ||
} | ||
} | ||
@@ -399,0 +402,0 @@ /** |
@@ -1,2 +0,2 @@ | ||
/*! a11y-dialog 8.1.0 — © Kitty Giraudel */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).A11yDialog=t()}(this,(function(){"use strict";const e=":not([inert]):not([inert] *)",t=':not([tabindex^="-"])',i=":not(:disabled)";var s=[`a[href]${e}${t}`,`area[href]${e}${t}`,`input:not([type="hidden"]):not([type="radio"])${e}${t}${i}`,`input[type="radio"]${e}${t}${i}`,`select${e}${t}${i}`,`textarea${e}${t}${i}`,`button${e}${t}${i}`,`details${e} > summary:first-of-type${t}`,`iframe${e}${t}`,`audio[controls]${e}${t}`,`video[controls]${e}${t}`,`[contenteditable]${e}${t}`,`[tabindex]${e}${t}`];function n(e){(e.querySelector("[autofocus]")||e).focus()}function o(e,t){if(t&&l(e))return e;if(function(e){return(!e.shadowRoot||"-1"!==e.getAttribute("tabindex"))&&!e.matches(":disabled,[hidden],[inert]")}(e))if(e.shadowRoot){let i=r(e.shadowRoot,t);for(;i;){const e=o(i,t);if(e)return e;i=d(i,t)}}else if("slot"===e.localName){const i=e.assignedElements({flatten:!0});t||i.reverse();for(const e of i){const i=o(e,t);if(i)return i}}else{let i=r(e,t);for(;i;){const e=o(i,t);if(e)return e;i=d(i,t)}}return!t&&l(e)?e:null}function r(e,t){return t?e.firstElementChild:e.lastElementChild}function d(e,t){return t?e.nextElementSibling:e.previousElementSibling}const l=e=>!e.shadowRoot?.delegatesFocus&&(e.matches(s.join(","))&&!(e=>!(!e.matches("details:not([open]) *")||e.matches("details>summary:first-of-type"))||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length))(e));function h(e=document){const t=e.activeElement;return t?t.shadowRoot?h(t.shadowRoot)||document.activeElement:t:null}function a(e,t){const[i,s]=function(e){const t=o(e,!0);return[t,t?o(e,!1)||t:null]}(e);if(!i)return t.preventDefault();const n=h();t.shiftKey&&n===i?(s.focus(),t.preventDefault()):t.shiftKey||n!==s||(i.focus(),t.preventDefault())}const u="data-a11y-dialog";class c{$el;id;previouslyFocused;shown;constructor(e){this.$el=e,this.id=this.$el.getAttribute(u)||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.fire("destroy").defaultPrevented||(this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0))),this}show(e){if(this.shown)return this;return this.fire("show",e).defaultPrevented||(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=h(),"BODY"===this.previouslyFocused?.tagName&&e?.target&&(this.previouslyFocused=e.target),"focus"===e?.type?this.maintainFocus(e):n(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0)),this}hide(e){if(!this.shown)return this;return this.fire("hide",e).defaultPrevented||(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this.previouslyFocused?.focus?.(),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0)),this}on(e,t,i){return this.$el.addEventListener(e,t,i),this}off(e,t,i){return this.$el.removeEventListener(e,t,i),this}fire(e,t){const i=new CustomEvent(e,{detail:t,cancelable:!0});return this.$el.dispatchEvent(i),i}handleTriggerClicks(e){const t=e.composedPath()[0];t.closest(`[${u}-show="${this.id}"]`)&&this.show(e),(t.closest(`[${u}-hide="${this.id}"]`)||t.closest(`[${u}-hide]`)&&t.closest('[aria-modal="true"]')===this.$el)&&this.hide(e)}bindKeypress(e){if(t='[aria-modal="true"]',function e(i){return i&&i!==document&&i!==window?(i.assignedSlot&&(i=i.assignedSlot),i.closest(t)||e(i.getRootNode().host)):null}(h())!==this.$el)return;var t;let i=!1;try{i=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}"Escape"!==e.key||"alertdialog"===this.$el.getAttribute("role")||i||(e.preventDefault(),this.hide(e)),"Tab"===e.key&&a(this.$el,e)}maintainFocus(e){e.target.closest(`[aria-modal="true"], [${u}-ignore-focus-trap]`)||n(this.$el)}}function f(){for(const e of document.querySelectorAll("[data-a11y-dialog]"))new c(e)}return"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",f):f()),c})); | ||
/*! a11y-dialog 8.1.1 — © Kitty Giraudel */ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).A11yDialog=t()}(this,(function(){"use strict";const e=":not([inert]):not([inert] *)",t=':not([tabindex^="-"])',i=":not(:disabled)";var s=[`a[href]${e}${t}`,`area[href]${e}${t}`,`input:not([type="hidden"]):not([type="radio"])${e}${t}${i}`,`input[type="radio"]${e}${t}${i}`,`select${e}${t}${i}`,`textarea${e}${t}${i}`,`button${e}${t}${i}`,`details${e} > summary:first-of-type${t}`,`iframe${e}${t}`,`audio[controls]${e}${t}`,`video[controls]${e}${t}`,`[contenteditable]${e}${t}`,`[tabindex]${e}${t}`];function n(e){(e.querySelector("[autofocus]")||e).focus()}function o(e,t){if(t&&h(e))return e;if(function(e){return(!e.shadowRoot||"-1"!==e.getAttribute("tabindex"))&&!e.matches(":disabled,[hidden],[inert]")}(e))if(e.shadowRoot){let i=r(e.shadowRoot,t);for(;i;){const e=o(i,t);if(e)return e;i=d(i,t)}}else if("slot"===e.localName){const i=e.assignedElements({flatten:!0});t||i.reverse();for(const e of i){const i=o(e,t);if(i)return i}}else{let i=r(e,t);for(;i;){const e=o(i,t);if(e)return e;i=d(i,t)}}return!t&&h(e)?e:null}function r(e,t){return t?e.firstElementChild:e.lastElementChild}function d(e,t){return t?e.nextElementSibling:e.previousElementSibling}const h=e=>!e.shadowRoot?.delegatesFocus&&(e.matches(s.join(","))&&!(e=>!(!e.matches("details:not([open]) *")||e.matches("details>summary:first-of-type"))||!(e.offsetWidth||e.offsetHeight||e.getClientRects().length))(e));function l(e=document){const t=e.activeElement;return t?t.shadowRoot?l(t.shadowRoot)||document.activeElement:t:null}function a(e,t){const[i,s]=function(e){const t=o(e,!0);return[t,t?o(e,!1)||t:null]}(e);if(!i)return t.preventDefault();const n=l();t.shiftKey&&n===i?(s.focus(),t.preventDefault()):t.shiftKey||n!==s||(i.focus(),t.preventDefault())}function u(e,t){return function t(i){return i&&i!==document&&i!==window?(i.assignedSlot&&(i=i.assignedSlot),i.closest(e)||t(i.getRootNode().host)):null}(t)}const c="data-a11y-dialog";class f{$el;id;previouslyFocused;shown;constructor(e){this.$el=e,this.id=this.$el.getAttribute(c)||this.$el.id,this.previouslyFocused=null,this.shown=!1,this.maintainFocus=this.maintainFocus.bind(this),this.bindKeypress=this.bindKeypress.bind(this),this.handleTriggerClicks=this.handleTriggerClicks.bind(this),this.show=this.show.bind(this),this.hide=this.hide.bind(this),this.$el.setAttribute("aria-hidden","true"),this.$el.setAttribute("aria-modal","true"),this.$el.setAttribute("tabindex","-1"),this.$el.hasAttribute("role")||this.$el.setAttribute("role","dialog"),document.addEventListener("click",this.handleTriggerClicks,!0)}destroy(){return this.fire("destroy").defaultPrevented||(this.hide(),document.removeEventListener("click",this.handleTriggerClicks,!0),this.$el.replaceWith(this.$el.cloneNode(!0))),this}show(e){if(this.shown)return this;return this.fire("show",e).defaultPrevented||(this.shown=!0,this.$el.removeAttribute("aria-hidden"),this.previouslyFocused=l(),"BODY"===this.previouslyFocused?.tagName&&e?.target&&(this.previouslyFocused=e.target),"focus"===e?.type?this.maintainFocus(e):n(this.$el),document.body.addEventListener("focus",this.maintainFocus,!0),this.$el.addEventListener("keydown",this.bindKeypress,!0)),this}hide(e){if(!this.shown)return this;return this.fire("hide",e).defaultPrevented||(this.shown=!1,this.$el.setAttribute("aria-hidden","true"),this.previouslyFocused?.focus?.(),document.body.removeEventListener("focus",this.maintainFocus,!0),this.$el.removeEventListener("keydown",this.bindKeypress,!0)),this}on(e,t,i){return this.$el.addEventListener(e,t,i),this}off(e,t,i){return this.$el.removeEventListener(e,t,i),this}fire(e,t){const i=new CustomEvent(e,{detail:t,cancelable:!0});return this.$el.dispatchEvent(i),i}handleTriggerClicks(e){const t=e.composedPath()[0],i=u(`[${c}-show="${this.id}"]`,t),s=u(`[${c}-hide="${this.id}"]`,t),n=u(`[${c}-hide]`,t)&&u('[aria-modal="true"]',t)===this.$el;i&&this.show(e),(s||n)&&this.hide(e)}bindKeypress(e){if(u('[aria-modal="true"]',l())!==this.$el)return;let t=!1;try{t=!!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open')}catch{}"Escape"!==e.key||"alertdialog"===this.$el.getAttribute("role")||t||(e.preventDefault(),this.hide(e)),"Tab"===e.key&&a(this.$el,e)}maintainFocus(e){e.target.closest(`[aria-modal="true"], [${c}-ignore-focus-trap]`)||n(this.$el)}}function $(){for(const e of document.querySelectorAll("[data-a11y-dialog]"))new f(e)}return"undefined"!=typeof document&&("loading"===document.readyState?document.addEventListener("DOMContentLoaded",$):$()),f})); |
{ | ||
"name": "a11y-dialog", | ||
"type": "module", | ||
"version": "8.1.0", | ||
"version": "8.1.1", | ||
"description": "A tiny script to make dialog windows accessible to assistive technology users.", | ||
@@ -6,0 +6,0 @@ "homepage": "https://a11y-dialog.netlify.app/", |
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
74505
1498