Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

tabbable

Package Overview
Dependencies
Maintainers
2
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tabbable - npm Package Compare versions

Comparing version 6.1.0 to 6.1.1

6

CHANGELOG.md
# Changelog
## 6.1.1
### Patch Changes
- 97373cc: Fix JSDom not supporting HTMLElement.inert and HTMLElement.contentEditable APIs, and not supporting CSS selector ':not([inert *])' resulting in no nodes found and "focus-trap must have at least one tabbable node..." error in focus-trap.
## 6.1.0

@@ -4,0 +10,0 @@

52

dist/index.esm.js
/*!
* tabbable 6.1.0
* tabbable 6.1.1
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/
// separate `:not()` selectors has broader browser support than the newer
// NOTE: separate `:not()` selectors has broader browser support than the newer
// `:not([inert], [inert] *)` (Feb 2023)
var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];
// CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
// the entire query to fail, resulting in no nodes found, which will break a lot
// of things... so we have to rely on JS to identify nodes inside an inert container
var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');

@@ -20,3 +23,3 @@ var NoElement = typeof Element === 'undefined';

* Determines if a node is inert or in an inert ancestor.
* @param {Element} node
* @param {Element} [node]
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to

@@ -28,12 +31,37 @@ * see if any of them are inert. If false, only `node` itself is considered.

var isInert = function isInert(node, lookUp) {
var _node$getAttribute;
if (lookUp === void 0) {
lookUp = true;
}
// CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
// JS API property; we have to check the attribute, which can either be empty or 'true';
// if it's `null` (not specified) or 'false', it's an active element
var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');
var inert = inertAtt === '' || inertAtt === 'true';
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
// if it weren't for `matches()` not being a function on shadow roots; the following
// code works for any kind of node
return !!(node !== null && node !== void 0 && node.inert || lookUp && node && isInert(node.parentNode)); // recursive
// CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
// so it likely would not support `:is([inert] *)` either...
var result = inert || lookUp && node && isInert(node.parentNode); // recursive
return result;
};
/**
* Determines if a node's content is editable.
* @param {Element} [node]
* @returns True if it's content-editable; false if it's not or `node` is falsy.
*/
var isContentEditable = function isContentEditable(node) {
var _node$getAttribute2;
// CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
// to use the attribute directly to check for this, which can either be empty or 'true';
// if it's `null` (not specified) or 'false', it's a non-editable element
var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');
return attValue === '' || attValue === 'true';
};
/**
* @param {Element} el container to check in

@@ -45,2 +73,4 @@ * @param {boolean} includeContainer add container to check

var getCandidates = function getCandidates(el, includeContainer, filter) {
// even if `includeContainer=false`, we still have to check it for inertness because
// if it's inert, all its children are inert
if (isInert(el)) {

@@ -168,3 +198,3 @@ return [];

// content to be inserted in the correct position
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
return 0;

@@ -406,6 +436,6 @@ }

if (node.disabled ||
// no inert look up: we should have looked up from the container already and
// the `candidateSelector` results should have also filtered out any elements
// inside an inert ancestor
isInert(node, false) || isHiddenInput(node) || isHidden(node, options) ||
// we must do an inert look up to filter out any elements inside an inert ancestor
// because we're limited in the type of selectors we can use in JSDom (see related
// note related to `candidateSelectors`)
isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
// For a details element with a summary, the summary element gets the focus

@@ -501,3 +531,3 @@ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {

};
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe:not([inert] *)').join(',');
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
var isFocusable = function isFocusable(node, options) {

@@ -504,0 +534,0 @@ options = options || {};

/*!
* tabbable 6.1.0
* tabbable 6.1.1
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/
var t=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],n=t.join(","),e="undefined"==typeof Element,o=e?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,r=!e&&Element.prototype.getRootNode?function(t){var n;return null==t||null===(n=t.getRootNode)||void 0===n?void 0:n.call(t)}:function(t){return null==t?void 0:t.ownerDocument},i=function t(n,e){return void 0===e&&(e=!0),!!(null!=n&&n.inert||e&&n&&t(n.parentNode))},a=function(t,e,r){if(i(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(n));return e&&o.call(t,n)&&a.unshift(t),a=a.filter(r)},l=function t(e,r,a){for(var l=[],u=Array.from(e);u.length;){var d=u.shift();if(!i(d,!1))if("SLOT"===d.tagName){var c=d.assignedElements(),f=t(c.length?c:d.children,!0,a);a.flatten?l.push.apply(l,f):l.push({scopeParent:d,candidates:f})}else{o.call(d,n)&&a.filter(d)&&(r||!e.includes(d))&&l.push(d);var s=d.shadowRoot||"function"==typeof a.getShadowRoot&&a.getShadowRoot(d),p=!i(s,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(d));if(s&&p){var h=t(!0===s?d.children:s.children,!0,a);a.flatten?l.push.apply(l,h):l.push({scopeParent:d,candidates:h})}else u.unshift.apply(u,d.children)}}return l},u=function(t,n){return t.tabIndex<0&&(n||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||t.isContentEditable)&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},d=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},c=function(t){return"INPUT"===t.tagName},f=function(t){return function(t){return c(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var n,e=t.form||r(t),o=function(t){return e.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)n=o(window.CSS.escape(t.name));else try{n=o(t.name)}catch(t){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",t.message),!1}var i=function(t,n){for(var e=0;e<t.length;e++)if(t[e].checked&&t[e].form===n)return t[e]}(n,t.form);return!i||i===t}(t)},s=function(t){var n=t.getBoundingClientRect(),e=n.width,o=n.height;return 0===e&&0===o},p=function(t,n){var e=n.displayCheck,i=n.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var a=o.call(t,"details>summary:first-of-type")?t.parentElement:t;if(o.call(a,"details:not([open]) *"))return!0;if(e&&"full"!==e&&"legacy-full"!==e){if("non-zero-area"===e)return s(t)}else{if("function"==typeof i){for(var l=t;t;){var u=t.parentElement,d=r(t);if(u&&!u.shadowRoot&&!0===i(u))return s(t);t=t.assignedSlot?t.assignedSlot:u||d===t.ownerDocument?u:d.host}t=l}if(function(t){var n,e,o,i,a=t&&r(t),l=null===(n=a)||void 0===n?void 0:n.host,u=!1;if(a&&a!==t)for(u=!!(null!==(e=l)&&void 0!==e&&null!==(o=e.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(i=t.ownerDocument)&&void 0!==i&&i.contains(t));!u&&l;){var d,c,f;u=!(null===(c=l=null===(d=a=r(l))||void 0===d?void 0:d.host)||void 0===c||null===(f=c.ownerDocument)||void 0===f||!f.contains(l))}return u}(t))return!t.getClientRects().length;if("legacy-full"!==e)return!0}return!1},h=function(t,n){return!(n.disabled||i(n,!1)||function(t){return c(t)&&"hidden"===t.type}(n)||p(n,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some((function(t){return"SUMMARY"===t.tagName}))}(n)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if("FIELDSET"===n.tagName&&n.disabled){for(var e=0;e<n.children.length;e++){var r=n.children.item(e);if("LEGEND"===r.tagName)return!!o.call(n,"fieldset[disabled] *")||!r.contains(t)}return!0}n=n.parentElement}return!1}(n))},m=function(t,n){return!(f(n)||u(n)<0||!h(t,n))},v=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},g=function t(n){var e=[],o=[];return n.forEach((function(n,r){var i=!!n.scopeParent,a=i?n.scopeParent:n,l=u(a,i),d=i?t(n.candidates):a;0===l?i?e.push.apply(e,d):e.push(a):o.push({documentOrder:r,tabIndex:l,item:n,isScope:i,content:d})})),o.sort(d).reduce((function(t,n){return n.isScope?t.push.apply(t,n.content):t.push(n.content),t}),[]).concat(e)},y=function(t,n){var e;return e=(n=n||{}).getShadowRoot?l([t],n.includeContainer,{filter:m.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:v}):a(t,n.includeContainer,m.bind(null,n)),g(e)},w=function(t,n){return(n=n||{}).getShadowRoot?l([t],n.includeContainer,{filter:h.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):a(t,n.includeContainer,h.bind(null,n))},S=function(t,e){if(e=e||{},!t)throw new Error("No node provided");return!1!==o.call(t,n)&&m(e,t)},b=t.concat("iframe:not([inert] *)").join(","),E=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return!1!==o.call(t,b)&&h(n,t)};export{w as focusable,E as isFocusable,S as isTabbable,y as tabbable};
var t=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],e=t.join(","),n="undefined"==typeof Element,o=n?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,r=!n&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},i=function t(e,n){var o;void 0===n&&(n=!0);var r=null==e||null===(o=e.getAttribute)||void 0===o?void 0:o.call(e,"inert");return""===r||"true"===r||n&&e&&t(e.parentNode)},a=function(t,n,r){if(i(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(e));return n&&o.call(t,e)&&a.unshift(t),a=a.filter(r)},l=function t(n,r,a){for(var l=[],u=Array.from(n);u.length;){var d=u.shift();if(!i(d,!1))if("SLOT"===d.tagName){var c=d.assignedElements(),f=t(c.length?c:d.children,!0,a);a.flatten?l.push.apply(l,f):l.push({scopeParent:d,candidates:f})}else{o.call(d,e)&&a.filter(d)&&(r||!n.includes(d))&&l.push(d);var s=d.shadowRoot||"function"==typeof a.getShadowRoot&&a.getShadowRoot(d),p=!i(s,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(d));if(s&&p){var h=t(!0===s?d.children:s.children,!0,a);a.flatten?l.push.apply(l,h):l.push({scopeParent:d,candidates:h})}else u.unshift.apply(u,d.children)}}return l},u=function(t,e){return t.tabIndex<0&&(e||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||function(t){var e,n=null==t||null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return""===n||"true"===n}(t))&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},d=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},c=function(t){return"INPUT"===t.tagName},f=function(t){return function(t){return c(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,n=t.form||r(t),o=function(t){return n.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=o(window.CSS.escape(t.name));else try{e=o(t.name)}catch(t){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",t.message),!1}var i=function(t,e){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===e)return t[n]}(e,t.form);return!i||i===t}(t)},s=function(t){var e=t.getBoundingClientRect(),n=e.width,o=e.height;return 0===n&&0===o},p=function(t,e){var n=e.displayCheck,i=e.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var a=o.call(t,"details>summary:first-of-type")?t.parentElement:t;if(o.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return s(t)}else{if("function"==typeof i){for(var l=t;t;){var u=t.parentElement,d=r(t);if(u&&!u.shadowRoot&&!0===i(u))return s(t);t=t.assignedSlot?t.assignedSlot:u||d===t.ownerDocument?u:d.host}t=l}if(function(t){var e,n,o,i,a=t&&r(t),l=null===(e=a)||void 0===e?void 0:e.host,u=!1;if(a&&a!==t)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(i=t.ownerDocument)&&void 0!==i&&i.contains(t));!u&&l;){var d,c,f;u=!(null===(c=l=null===(d=a=r(l))||void 0===d?void 0:d.host)||void 0===c||null===(f=c.ownerDocument)||void 0===f||!f.contains(l))}return u}(t))return!t.getClientRects().length;if("legacy-full"!==n)return!0}return!1},h=function(t,e){return!(e.disabled||i(e)||function(t){return c(t)&&"hidden"===t.type}(e)||p(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some((function(t){return"SUMMARY"===t.tagName}))}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var n=0;n<e.children.length;n++){var r=e.children.item(n);if("LEGEND"===r.tagName)return!!o.call(e,"fieldset[disabled] *")||!r.contains(t)}return!0}e=e.parentElement}return!1}(e))},v=function(t,e){return!(f(e)||u(e)<0||!h(t,e))},m=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},g=function t(e){var n=[],o=[];return e.forEach((function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,l=u(a,i),d=i?t(e.candidates):a;0===l?i?n.push.apply(n,d):n.push(a):o.push({documentOrder:r,tabIndex:l,item:e,isScope:i,content:d})})),o.sort(d).reduce((function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t}),[]).concat(n)},y=function(t,e){var n;return n=(e=e||{}).getShadowRoot?l([t],e.includeContainer,{filter:v.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:m}):a(t,e.includeContainer,v.bind(null,e)),g(n)},w=function(t,e){return(e=e||{}).getShadowRoot?l([t],e.includeContainer,{filter:h.bind(null,e),flatten:!0,getShadowRoot:e.getShadowRoot}):a(t,e.includeContainer,h.bind(null,e))},S=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return!1!==o.call(t,e)&&v(n,t)},b=t.concat("iframe").join(","),E=function(t,e){if(e=e||{},!t)throw new Error("No node provided");return!1!==o.call(t,b)&&h(e,t)};export{w as focusable,E as isFocusable,S as isTabbable,y as tabbable};
//# sourceMappingURL=index.esm.min.js.map
/*!
* tabbable 6.1.0
* tabbable 6.1.1
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE

@@ -9,5 +9,8 @@ */

// separate `:not()` selectors has broader browser support than the newer
// NOTE: separate `:not()` selectors has broader browser support than the newer
// `:not([inert], [inert] *)` (Feb 2023)
var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];
// CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
// the entire query to fail, resulting in no nodes found, which will break a lot
// of things... so we have to rely on JS to identify nodes inside an inert container
var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');

@@ -25,3 +28,3 @@ var NoElement = typeof Element === 'undefined';

* Determines if a node is inert or in an inert ancestor.
* @param {Element} node
* @param {Element} [node]
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to

@@ -33,12 +36,37 @@ * see if any of them are inert. If false, only `node` itself is considered.

var isInert = function isInert(node, lookUp) {
var _node$getAttribute;
if (lookUp === void 0) {
lookUp = true;
}
// CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
// JS API property; we have to check the attribute, which can either be empty or 'true';
// if it's `null` (not specified) or 'false', it's an active element
var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');
var inert = inertAtt === '' || inertAtt === 'true';
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
// if it weren't for `matches()` not being a function on shadow roots; the following
// code works for any kind of node
return !!(node !== null && node !== void 0 && node.inert || lookUp && node && isInert(node.parentNode)); // recursive
// CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
// so it likely would not support `:is([inert] *)` either...
var result = inert || lookUp && node && isInert(node.parentNode); // recursive
return result;
};
/**
* Determines if a node's content is editable.
* @param {Element} [node]
* @returns True if it's content-editable; false if it's not or `node` is falsy.
*/
var isContentEditable = function isContentEditable(node) {
var _node$getAttribute2;
// CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
// to use the attribute directly to check for this, which can either be empty or 'true';
// if it's `null` (not specified) or 'false', it's a non-editable element
var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');
return attValue === '' || attValue === 'true';
};
/**
* @param {Element} el container to check in

@@ -50,2 +78,4 @@ * @param {boolean} includeContainer add container to check

var getCandidates = function getCandidates(el, includeContainer, filter) {
// even if `includeContainer=false`, we still have to check it for inertness because
// if it's inert, all its children are inert
if (isInert(el)) {

@@ -173,3 +203,3 @@ return [];

// content to be inserted in the correct position
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
return 0;

@@ -411,6 +441,6 @@ }

if (node.disabled ||
// no inert look up: we should have looked up from the container already and
// the `candidateSelector` results should have also filtered out any elements
// inside an inert ancestor
isInert(node, false) || isHiddenInput(node) || isHidden(node, options) ||
// we must do an inert look up to filter out any elements inside an inert ancestor
// because we're limited in the type of selectors we can use in JSDom (see related
// note related to `candidateSelectors`)
isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
// For a details element with a summary, the summary element gets the focus

@@ -506,3 +536,3 @@ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {

};
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe:not([inert] *)').join(',');
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
var isFocusable = function isFocusable(node, options) {

@@ -509,0 +539,0 @@ options = options || {};

/*!
* tabbable 6.1.0
* tabbable 6.1.1
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],e=t.join(","),n="undefined"==typeof Element,o=n?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,r=!n&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},i=function t(e,n){return void 0===n&&(n=!0),!!(null!=e&&e.inert||n&&e&&t(e.parentNode))},a=function(t,n,r){if(i(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(e));return n&&o.call(t,e)&&a.unshift(t),a=a.filter(r)},l=function t(n,r,a){for(var l=[],u=Array.from(n);u.length;){var d=u.shift();if(!i(d,!1))if("SLOT"===d.tagName){var c=d.assignedElements(),s=t(c.length?c:d.children,!0,a);a.flatten?l.push.apply(l,s):l.push({scopeParent:d,candidates:s})}else{o.call(d,e)&&a.filter(d)&&(r||!n.includes(d))&&l.push(d);var f=d.shadowRoot||"function"==typeof a.getShadowRoot&&a.getShadowRoot(d),p=!i(f,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(d));if(f&&p){var h=t(!0===f?d.children:f.children,!0,a);a.flatten?l.push.apply(l,h):l.push({scopeParent:d,candidates:h})}else u.unshift.apply(u,d.children)}}return l},u=function(t,e){return t.tabIndex<0&&(e||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||t.isContentEditable)&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},d=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},c=function(t){return"INPUT"===t.tagName},s=function(t){return function(t){return c(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,n=t.form||r(t),o=function(t){return n.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=o(window.CSS.escape(t.name));else try{e=o(t.name)}catch(t){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",t.message),!1}var i=function(t,e){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===e)return t[n]}(e,t.form);return!i||i===t}(t)},f=function(t){var e=t.getBoundingClientRect(),n=e.width,o=e.height;return 0===n&&0===o},p=function(t,e){var n=e.displayCheck,i=e.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var a=o.call(t,"details>summary:first-of-type")?t.parentElement:t;if(o.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return f(t)}else{if("function"==typeof i){for(var l=t;t;){var u=t.parentElement,d=r(t);if(u&&!u.shadowRoot&&!0===i(u))return f(t);t=t.assignedSlot?t.assignedSlot:u||d===t.ownerDocument?u:d.host}t=l}if(function(t){var e,n,o,i,a=t&&r(t),l=null===(e=a)||void 0===e?void 0:e.host,u=!1;if(a&&a!==t)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(i=t.ownerDocument)&&void 0!==i&&i.contains(t));!u&&l;){var d,c,s;u=!(null===(c=l=null===(d=a=r(l))||void 0===d?void 0:d.host)||void 0===c||null===(s=c.ownerDocument)||void 0===s||!s.contains(l))}return u}(t))return!t.getClientRects().length;if("legacy-full"!==n)return!0}return!1},h=function(t,e){return!(e.disabled||i(e,!1)||function(t){return c(t)&&"hidden"===t.type}(e)||p(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some((function(t){return"SUMMARY"===t.tagName}))}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var n=0;n<e.children.length;n++){var r=e.children.item(n);if("LEGEND"===r.tagName)return!!o.call(e,"fieldset[disabled] *")||!r.contains(t)}return!0}e=e.parentElement}return!1}(e))},m=function(t,e){return!(s(e)||u(e)<0||!h(t,e))},v=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},y=function t(e){var n=[],o=[];return e.forEach((function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,l=u(a,i),d=i?t(e.candidates):a;0===l?i?n.push.apply(n,d):n.push(a):o.push({documentOrder:r,tabIndex:l,item:e,isScope:i,content:d})})),o.sort(d).reduce((function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t}),[]).concat(n)},g=t.concat("iframe:not([inert] *)").join(",");exports.focusable=function(t,e){return(e=e||{}).getShadowRoot?l([t],e.includeContainer,{filter:h.bind(null,e),flatten:!0,getShadowRoot:e.getShadowRoot}):a(t,e.includeContainer,h.bind(null,e))},exports.isFocusable=function(t,e){if(e=e||{},!t)throw new Error("No node provided");return!1!==o.call(t,g)&&h(e,t)},exports.isTabbable=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return!1!==o.call(t,e)&&m(n,t)},exports.tabbable=function(t,e){var n;return n=(e=e||{}).getShadowRoot?l([t],e.includeContainer,{filter:m.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:v}):a(t,e.includeContainer,m.bind(null,e)),y(n)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],e=t.join(","),n="undefined"==typeof Element,o=n?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,r=!n&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},i=function t(e,n){var o;void 0===n&&(n=!0);var r=null==e||null===(o=e.getAttribute)||void 0===o?void 0:o.call(e,"inert");return""===r||"true"===r||n&&e&&t(e.parentNode)},a=function(t,n,r){if(i(t))return[];var a=Array.prototype.slice.apply(t.querySelectorAll(e));return n&&o.call(t,e)&&a.unshift(t),a=a.filter(r)},l=function t(n,r,a){for(var l=[],u=Array.from(n);u.length;){var d=u.shift();if(!i(d,!1))if("SLOT"===d.tagName){var c=d.assignedElements(),s=t(c.length?c:d.children,!0,a);a.flatten?l.push.apply(l,s):l.push({scopeParent:d,candidates:s})}else{o.call(d,e)&&a.filter(d)&&(r||!n.includes(d))&&l.push(d);var f=d.shadowRoot||"function"==typeof a.getShadowRoot&&a.getShadowRoot(d),p=!i(f,!1)&&(!a.shadowRootFilter||a.shadowRootFilter(d));if(f&&p){var h=t(!0===f?d.children:f.children,!0,a);a.flatten?l.push.apply(l,h):l.push({scopeParent:d,candidates:h})}else u.unshift.apply(u,d.children)}}return l},u=function(t,e){return t.tabIndex<0&&(e||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||function(t){var e,n=null==t||null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return""===n||"true"===n}(t))&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},d=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},c=function(t){return"INPUT"===t.tagName},s=function(t){return function(t){return c(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,n=t.form||r(t),o=function(t){return n.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=o(window.CSS.escape(t.name));else try{e=o(t.name)}catch(t){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",t.message),!1}var i=function(t,e){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===e)return t[n]}(e,t.form);return!i||i===t}(t)},f=function(t){var e=t.getBoundingClientRect(),n=e.width,o=e.height;return 0===n&&0===o},p=function(t,e){var n=e.displayCheck,i=e.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var a=o.call(t,"details>summary:first-of-type")?t.parentElement:t;if(o.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return f(t)}else{if("function"==typeof i){for(var l=t;t;){var u=t.parentElement,d=r(t);if(u&&!u.shadowRoot&&!0===i(u))return f(t);t=t.assignedSlot?t.assignedSlot:u||d===t.ownerDocument?u:d.host}t=l}if(function(t){var e,n,o,i,a=t&&r(t),l=null===(e=a)||void 0===e?void 0:e.host,u=!1;if(a&&a!==t)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(i=t.ownerDocument)&&void 0!==i&&i.contains(t));!u&&l;){var d,c,s;u=!(null===(c=l=null===(d=a=r(l))||void 0===d?void 0:d.host)||void 0===c||null===(s=c.ownerDocument)||void 0===s||!s.contains(l))}return u}(t))return!t.getClientRects().length;if("legacy-full"!==n)return!0}return!1},h=function(t,e){return!(e.disabled||i(e)||function(t){return c(t)&&"hidden"===t.type}(e)||p(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some((function(t){return"SUMMARY"===t.tagName}))}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var n=0;n<e.children.length;n++){var r=e.children.item(n);if("LEGEND"===r.tagName)return!!o.call(e,"fieldset[disabled] *")||!r.contains(t)}return!0}e=e.parentElement}return!1}(e))},v=function(t,e){return!(s(e)||u(e)<0||!h(t,e))},m=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},g=function t(e){var n=[],o=[];return e.forEach((function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,l=u(a,i),d=i?t(e.candidates):a;0===l?i?n.push.apply(n,d):n.push(a):o.push({documentOrder:r,tabIndex:l,item:e,isScope:i,content:d})})),o.sort(d).reduce((function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t}),[]).concat(n)},y=t.concat("iframe").join(",");exports.focusable=function(t,e){return(e=e||{}).getShadowRoot?l([t],e.includeContainer,{filter:h.bind(null,e),flatten:!0,getShadowRoot:e.getShadowRoot}):a(t,e.includeContainer,h.bind(null,e))},exports.isFocusable=function(t,e){if(e=e||{},!t)throw new Error("No node provided");return!1!==o.call(t,y)&&h(e,t)},exports.isTabbable=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return!1!==o.call(t,e)&&v(n,t)},exports.tabbable=function(t,e){var n;return n=(e=e||{}).getShadowRoot?l([t],e.includeContainer,{filter:v.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:m}):a(t,e.includeContainer,v.bind(null,e)),g(n)};
//# sourceMappingURL=index.min.js.map
/*!
* tabbable 6.1.0
* tabbable 6.1.1
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE

@@ -16,5 +16,8 @@ */

// separate `:not()` selectors has broader browser support than the newer
// NOTE: separate `:not()` selectors has broader browser support than the newer
// `:not([inert], [inert] *)` (Feb 2023)
var candidateSelectors = ['input:not([inert]):not([inert] *)', 'select:not([inert]):not([inert] *)', 'textarea:not([inert]):not([inert] *)', 'a[href]:not([inert]):not([inert] *)', 'button:not([inert]):not([inert] *)', '[tabindex]:not(slot):not([inert]):not([inert] *)', 'audio[controls]:not([inert]):not([inert] *)', 'video[controls]:not([inert]):not([inert] *)', '[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)', 'details>summary:first-of-type:not([inert]):not([inert] *)', 'details:not([inert]):not([inert] *)'];
// CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
// the entire query to fail, resulting in no nodes found, which will break a lot
// of things... so we have to rely on JS to identify nodes inside an inert container
var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');

@@ -32,3 +35,3 @@ var NoElement = typeof Element === 'undefined';

* Determines if a node is inert or in an inert ancestor.
* @param {Element} node
* @param {Element} [node]
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to

@@ -40,12 +43,37 @@ * see if any of them are inert. If false, only `node` itself is considered.

var isInert = function isInert(node, lookUp) {
var _node$getAttribute;
if (lookUp === void 0) {
lookUp = true;
}
// CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
// JS API property; we have to check the attribute, which can either be empty or 'true';
// if it's `null` (not specified) or 'false', it's an active element
var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');
var inert = inertAtt === '' || inertAtt === 'true';
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
// if it weren't for `matches()` not being a function on shadow roots; the following
// code works for any kind of node
return !!(node !== null && node !== void 0 && node.inert || lookUp && node && isInert(node.parentNode)); // recursive
// CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
// so it likely would not support `:is([inert] *)` either...
var result = inert || lookUp && node && isInert(node.parentNode); // recursive
return result;
};
/**
* Determines if a node's content is editable.
* @param {Element} [node]
* @returns True if it's content-editable; false if it's not or `node` is falsy.
*/
var isContentEditable = function isContentEditable(node) {
var _node$getAttribute2;
// CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
// to use the attribute directly to check for this, which can either be empty or 'true';
// if it's `null` (not specified) or 'false', it's a non-editable element
var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');
return attValue === '' || attValue === 'true';
};
/**
* @param {Element} el container to check in

@@ -57,2 +85,4 @@ * @param {boolean} includeContainer add container to check

var getCandidates = function getCandidates(el, includeContainer, filter) {
// even if `includeContainer=false`, we still have to check it for inertness because
// if it's inert, all its children are inert
if (isInert(el)) {

@@ -180,3 +210,3 @@ return [];

// content to be inserted in the correct position
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || node.isContentEditable) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
if ((isScope || /^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && isNaN(parseInt(node.getAttribute('tabindex'), 10))) {
return 0;

@@ -418,6 +448,6 @@ }

if (node.disabled ||
// no inert look up: we should have looked up from the container already and
// the `candidateSelector` results should have also filtered out any elements
// inside an inert ancestor
isInert(node, false) || isHiddenInput(node) || isHidden(node, options) ||
// we must do an inert look up to filter out any elements inside an inert ancestor
// because we're limited in the type of selectors we can use in JSDom (see related
// note related to `candidateSelectors`)
isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
// For a details element with a summary, the summary element gets the focus

@@ -513,3 +543,3 @@ isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {

};
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe:not([inert] *)').join(',');
var focusableCandidateSelector = /* #__PURE__ */candidateSelectors.concat('iframe').join(',');
var isFocusable = function isFocusable(node, options) {

@@ -516,0 +546,0 @@ options = options || {};

/*!
* tabbable 6.1.0
* tabbable 6.1.1
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
*/
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,function(){var n=t.tabbable,o=t.tabbable={};e(o),o.noConflict=function(){return t.tabbable=n,o}}())}(this,(function(t){"use strict";var e=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],n=e.join(","),o="undefined"==typeof Element,r=o?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=!o&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},a=function t(e,n){return void 0===n&&(n=!0),!!(null!=e&&e.inert||n&&e&&t(e.parentNode))},l=function(t,e,o){if(a(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(n));return e&&r.call(t,n)&&i.unshift(t),i=i.filter(o)},u=function t(e,o,i){for(var l=[],u=Array.from(e);u.length;){var d=u.shift();if(!a(d,!1))if("SLOT"===d.tagName){var c=d.assignedElements(),f=t(c.length?c:d.children,!0,i);i.flatten?l.push.apply(l,f):l.push({scopeParent:d,candidates:f})}else{r.call(d,n)&&i.filter(d)&&(o||!e.includes(d))&&l.push(d);var s=d.shadowRoot||"function"==typeof i.getShadowRoot&&i.getShadowRoot(d),p=!a(s,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(d));if(s&&p){var h=t(!0===s?d.children:s.children,!0,i);i.flatten?l.push.apply(l,h):l.push({scopeParent:d,candidates:h})}else u.unshift.apply(u,d.children)}}return l},d=function(t,e){return t.tabIndex<0&&(e||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||t.isContentEditable)&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},c=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},f=function(t){return"INPUT"===t.tagName},s=function(t){return function(t){return f(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,n=t.form||i(t),o=function(t){return n.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=o(window.CSS.escape(t.name));else try{e=o(t.name)}catch(t){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",t.message),!1}var r=function(t,e){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===e)return t[n]}(e,t.form);return!r||r===t}(t)},p=function(t){var e=t.getBoundingClientRect(),n=e.width,o=e.height;return 0===n&&0===o},h=function(t,e){var n=e.displayCheck,o=e.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var a=r.call(t,"details>summary:first-of-type")?t.parentElement:t;if(r.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return p(t)}else{if("function"==typeof o){for(var l=t;t;){var u=t.parentElement,d=i(t);if(u&&!u.shadowRoot&&!0===o(u))return p(t);t=t.assignedSlot?t.assignedSlot:u||d===t.ownerDocument?u:d.host}t=l}if(function(t){var e,n,o,r,a=t&&i(t),l=null===(e=a)||void 0===e?void 0:e.host,u=!1;if(a&&a!==t)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(r=t.ownerDocument)&&void 0!==r&&r.contains(t));!u&&l;){var d,c,f;u=!(null===(c=l=null===(d=a=i(l))||void 0===d?void 0:d.host)||void 0===c||null===(f=c.ownerDocument)||void 0===f||!f.contains(l))}return u}(t))return!t.getClientRects().length;if("legacy-full"!==n)return!0}return!1},m=function(t,e){return!(e.disabled||a(e,!1)||function(t){return f(t)&&"hidden"===t.type}(e)||h(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some((function(t){return"SUMMARY"===t.tagName}))}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var n=0;n<e.children.length;n++){var o=e.children.item(n);if("LEGEND"===o.tagName)return!!r.call(e,"fieldset[disabled] *")||!o.contains(t)}return!0}e=e.parentElement}return!1}(e))},b=function(t,e){return!(s(e)||d(e)<0||!m(t,e))},v=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},y=function t(e){var n=[],o=[];return e.forEach((function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,l=d(a,i),u=i?t(e.candidates):a;0===l?i?n.push.apply(n,u):n.push(a):o.push({documentOrder:r,tabIndex:l,item:e,isScope:i,content:u})})),o.sort(c).reduce((function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t}),[]).concat(n)},g=e.concat("iframe:not([inert] *)").join(",");t.focusable=function(t,e){return(e=e||{}).getShadowRoot?u([t],e.includeContainer,{filter:m.bind(null,e),flatten:!0,getShadowRoot:e.getShadowRoot}):l(t,e.includeContainer,m.bind(null,e))},t.isFocusable=function(t,e){if(e=e||{},!t)throw new Error("No node provided");return!1!==r.call(t,g)&&m(e,t)},t.isTabbable=function(t,e){if(e=e||{},!t)throw new Error("No node provided");return!1!==r.call(t,n)&&b(e,t)},t.tabbable=function(t,e){var n;return n=(e=e||{}).getShadowRoot?u([t],e.includeContainer,{filter:b.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:v}):l(t,e.includeContainer,b.bind(null,e)),y(n)},Object.defineProperty(t,"__esModule",{value:!0})}));
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):(t="undefined"!=typeof globalThis?globalThis:t||self,function(){var n=t.tabbable,o=t.tabbable={};e(o),o.noConflict=function(){return t.tabbable=n,o}}())}(this,(function(t){"use strict";var e=["input:not([inert])","select:not([inert])","textarea:not([inert])","a[href]:not([inert])","button:not([inert])","[tabindex]:not(slot):not([inert])","audio[controls]:not([inert])","video[controls]:not([inert])",'[contenteditable]:not([contenteditable="false"]):not([inert])',"details>summary:first-of-type:not([inert])","details:not([inert])"],n=e.join(","),o="undefined"==typeof Element,r=o?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,i=!o&&Element.prototype.getRootNode?function(t){var e;return null==t||null===(e=t.getRootNode)||void 0===e?void 0:e.call(t)}:function(t){return null==t?void 0:t.ownerDocument},a=function t(e,n){var o;void 0===n&&(n=!0);var r=null==e||null===(o=e.getAttribute)||void 0===o?void 0:o.call(e,"inert");return""===r||"true"===r||n&&e&&t(e.parentNode)},l=function(t,e,o){if(a(t))return[];var i=Array.prototype.slice.apply(t.querySelectorAll(n));return e&&r.call(t,n)&&i.unshift(t),i=i.filter(o)},u=function t(e,o,i){for(var l=[],u=Array.from(e);u.length;){var d=u.shift();if(!a(d,!1))if("SLOT"===d.tagName){var c=d.assignedElements(),f=t(c.length?c:d.children,!0,i);i.flatten?l.push.apply(l,f):l.push({scopeParent:d,candidates:f})}else{r.call(d,n)&&i.filter(d)&&(o||!e.includes(d))&&l.push(d);var s=d.shadowRoot||"function"==typeof i.getShadowRoot&&i.getShadowRoot(d),p=!a(s,!1)&&(!i.shadowRootFilter||i.shadowRootFilter(d));if(s&&p){var h=t(!0===s?d.children:s.children,!0,i);i.flatten?l.push.apply(l,h):l.push({scopeParent:d,candidates:h})}else u.unshift.apply(u,d.children)}}return l},d=function(t,e){return t.tabIndex<0&&(e||/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||function(t){var e,n=null==t||null===(e=t.getAttribute)||void 0===e?void 0:e.call(t,"contenteditable");return""===n||"true"===n}(t))&&isNaN(parseInt(t.getAttribute("tabindex"),10))?0:t.tabIndex},c=function(t,e){return t.tabIndex===e.tabIndex?t.documentOrder-e.documentOrder:t.tabIndex-e.tabIndex},f=function(t){return"INPUT"===t.tagName},s=function(t){return function(t){return f(t)&&"radio"===t.type}(t)&&!function(t){if(!t.name)return!0;var e,n=t.form||i(t),o=function(t){return n.querySelectorAll('input[type="radio"][name="'+t+'"]')};if("undefined"!=typeof window&&void 0!==window.CSS&&"function"==typeof window.CSS.escape)e=o(window.CSS.escape(t.name));else try{e=o(t.name)}catch(t){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",t.message),!1}var r=function(t,e){for(var n=0;n<t.length;n++)if(t[n].checked&&t[n].form===e)return t[n]}(e,t.form);return!r||r===t}(t)},p=function(t){var e=t.getBoundingClientRect(),n=e.width,o=e.height;return 0===n&&0===o},h=function(t,e){var n=e.displayCheck,o=e.getShadowRoot;if("hidden"===getComputedStyle(t).visibility)return!0;var a=r.call(t,"details>summary:first-of-type")?t.parentElement:t;if(r.call(a,"details:not([open]) *"))return!0;if(n&&"full"!==n&&"legacy-full"!==n){if("non-zero-area"===n)return p(t)}else{if("function"==typeof o){for(var l=t;t;){var u=t.parentElement,d=i(t);if(u&&!u.shadowRoot&&!0===o(u))return p(t);t=t.assignedSlot?t.assignedSlot:u||d===t.ownerDocument?u:d.host}t=l}if(function(t){var e,n,o,r,a=t&&i(t),l=null===(e=a)||void 0===e?void 0:e.host,u=!1;if(a&&a!==t)for(u=!!(null!==(n=l)&&void 0!==n&&null!==(o=n.ownerDocument)&&void 0!==o&&o.contains(l)||null!=t&&null!==(r=t.ownerDocument)&&void 0!==r&&r.contains(t));!u&&l;){var d,c,f;u=!(null===(c=l=null===(d=a=i(l))||void 0===d?void 0:d.host)||void 0===c||null===(f=c.ownerDocument)||void 0===f||!f.contains(l))}return u}(t))return!t.getClientRects().length;if("legacy-full"!==n)return!0}return!1},v=function(t,e){return!(e.disabled||a(e)||function(t){return f(t)&&"hidden"===t.type}(e)||h(e,t)||function(t){return"DETAILS"===t.tagName&&Array.prototype.slice.apply(t.children).some((function(t){return"SUMMARY"===t.tagName}))}(e)||function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var e=t.parentElement;e;){if("FIELDSET"===e.tagName&&e.disabled){for(var n=0;n<e.children.length;n++){var o=e.children.item(n);if("LEGEND"===o.tagName)return!!r.call(e,"fieldset[disabled] *")||!o.contains(t)}return!0}e=e.parentElement}return!1}(e))},b=function(t,e){return!(s(e)||d(e)<0||!v(t,e))},m=function(t){var e=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(e)||e>=0)},y=function t(e){var n=[],o=[];return e.forEach((function(e,r){var i=!!e.scopeParent,a=i?e.scopeParent:e,l=d(a,i),u=i?t(e.candidates):a;0===l?i?n.push.apply(n,u):n.push(a):o.push({documentOrder:r,tabIndex:l,item:e,isScope:i,content:u})})),o.sort(c).reduce((function(t,e){return e.isScope?t.push.apply(t,e.content):t.push(e.content),t}),[]).concat(n)},g=e.concat("iframe").join(",");t.focusable=function(t,e){return(e=e||{}).getShadowRoot?u([t],e.includeContainer,{filter:v.bind(null,e),flatten:!0,getShadowRoot:e.getShadowRoot}):l(t,e.includeContainer,v.bind(null,e))},t.isFocusable=function(t,e){if(e=e||{},!t)throw new Error("No node provided");return!1!==r.call(t,g)&&v(e,t)},t.isTabbable=function(t,e){if(e=e||{},!t)throw new Error("No node provided");return!1!==r.call(t,n)&&b(e,t)},t.tabbable=function(t,e){var n;return n=(e=e||{}).getShadowRoot?u([t],e.includeContainer,{filter:b.bind(null,e),flatten:!1,getShadowRoot:e.getShadowRoot,shadowRootFilter:m}):l(t,e.includeContainer,b.bind(null,e)),y(n)},Object.defineProperty(t,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map
{
"name": "tabbable",
"version": "6.1.0",
"version": "6.1.1",
"description": "Returns an array of all tabbable DOM nodes within a containing node.",

@@ -84,2 +84,3 @@ "main": "dist/index.js",

"jest": "^29.4.2",
"jest-environment-jsdom": "^29.4.3",
"jest-watch-typeahead": "^2.2.2",

@@ -86,0 +87,0 @@ "onchange": "^7.1.0",

@@ -1,15 +0,18 @@

// separate `:not()` selectors has broader browser support than the newer
// NOTE: separate `:not()` selectors has broader browser support than the newer
// `:not([inert], [inert] *)` (Feb 2023)
// CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
// the entire query to fail, resulting in no nodes found, which will break a lot
// of things... so we have to rely on JS to identify nodes inside an inert container
const candidateSelectors = [
'input:not([inert]):not([inert] *)',
'select:not([inert]):not([inert] *)',
'textarea:not([inert]):not([inert] *)',
'a[href]:not([inert]):not([inert] *)',
'button:not([inert]):not([inert] *)',
'[tabindex]:not(slot):not([inert]):not([inert] *)',
'audio[controls]:not([inert]):not([inert] *)',
'video[controls]:not([inert]):not([inert] *)',
'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',
'details>summary:first-of-type:not([inert]):not([inert] *)',
'details:not([inert]):not([inert] *)',
'input:not([inert])',
'select:not([inert])',
'textarea:not([inert])',
'a[href]:not([inert])',
'button:not([inert])',
'[tabindex]:not(slot):not([inert])',
'audio[controls]:not([inert])',
'video[controls]:not([inert])',
'[contenteditable]:not([contenteditable="false"]):not([inert])',
'details>summary:first-of-type:not([inert])',
'details:not([inert])',
];

@@ -33,3 +36,3 @@ const candidateSelector = /* #__PURE__ */ candidateSelectors.join(',');

* Determines if a node is inert or in an inert ancestor.
* @param {Element} node
* @param {Element} [node]
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to

@@ -41,9 +44,32 @@ * see if any of them are inert. If false, only `node` itself is considered.

const isInert = function (node, lookUp = true) {
// CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
// JS API property; we have to check the attribute, which can either be empty or 'true';
// if it's `null` (not specified) or 'false', it's an active element
const inertAtt = node?.getAttribute?.('inert');
const inert = inertAtt === '' || inertAtt === 'true';
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
// if it weren't for `matches()` not being a function on shadow roots; the following
// code works for any kind of node
return !!(node?.inert || (lookUp && node && isInert(node.parentNode))); // recursive
// CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
// so it likely would not support `:is([inert] *)` either...
const result = inert || (lookUp && node && isInert(node.parentNode)); // recursive
return result;
};
/**
* Determines if a node's content is editable.
* @param {Element} [node]
* @returns True if it's content-editable; false if it's not or `node` is falsy.
*/
const isContentEditable = function (node) {
// CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
// to use the attribute directly to check for this, which can either be empty or 'true';
// if it's `null` (not specified) or 'false', it's a non-editable element
const attValue = node?.getAttribute?.('contenteditable');
return attValue === '' || attValue === 'true';
};
/**
* @param {Element} el container to check in

@@ -55,2 +81,4 @@ * @param {boolean} includeContainer add container to check

const getCandidates = function (el, includeContainer, filter) {
// even if `includeContainer=false`, we still have to check it for inertness because
// if it's inert, all its children are inert
if (isInert(el)) {

@@ -204,3 +232,3 @@ return [];

/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) ||
node.isContentEditable) &&
isContentEditable(node)) &&
isNaN(parseInt(node.getAttribute('tabindex'), 10))

@@ -481,6 +509,6 @@ ) {

node.disabled ||
// no inert look up: we should have looked up from the container already and
// the `candidateSelector` results should have also filtered out any elements
// inside an inert ancestor
isInert(node, false) ||
// we must do an inert look up to filter out any elements inside an inert ancestor
// because we're limited in the type of selectors we can use in JSDom (see related
// note related to `candidateSelectors`)
isInert(node) ||
isHiddenInput(node) ||

@@ -610,3 +638,3 @@ isHidden(node, options) ||

const focusableCandidateSelector = /* #__PURE__ */ candidateSelectors
.concat('iframe:not([inert] *)')
.concat('iframe')
.join(',');

@@ -613,0 +641,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc