solid-dismiss
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -140,4 +140,3 @@ import { isServer, insert, template, delegateEvents, addEventListener, effect, setAttribute, classList, createComponent, mergeProps } from 'solid-js/web'; | ||
if (hasPassedVisitedElement) { | ||
if (ignoreElement.some(el => el === child)) continue; | ||
const el = queryTabbableElement(child, tabbableSelectors, direction); | ||
const el = queryTabbableElement(child, tabbableSelectors, direction, ignoreElement); | ||
@@ -165,4 +164,3 @@ if (el) { | ||
if (hasPassedVisitedElement) { | ||
if (ignoreElement.some(el => el === child)) continue; | ||
const el = queryTabbableElement(child, tabbableSelectors, direction); | ||
const el = queryTabbableElement(child, tabbableSelectors, direction, ignoreElement); | ||
if (el) return el; | ||
@@ -252,3 +250,3 @@ continue; | ||
const queryTabbableElement = (el, selectors = _tabbableSelectors, iterationDirection = "forwards", windowContext = window, init = true) => { | ||
const queryTabbableElement = (el, selectors = _tabbableSelectors, iterationDirection = "forwards", ignoreElement = [], windowContext = window, init = true) => { | ||
const queryChild = el => { | ||
@@ -287,3 +285,3 @@ if (!el.matches(selectors)) return { | ||
if (init) { | ||
if (isHidden(el, windowContext)) return null; | ||
if (ignoreElement.some(item => item === el) || isHidden(el, windowContext)) return null; | ||
const { | ||
@@ -297,3 +295,3 @@ el: elResult, | ||
windowContext = windowContextResult || windowContext; | ||
return queryTabbableElement(el, selectors, iterationDirection, windowContext, false); | ||
return queryTabbableElement(el, selectors, iterationDirection, ignoreElement, windowContext, false); | ||
} | ||
@@ -307,3 +305,3 @@ | ||
const iterateChild = el => { | ||
if (isHidden(el, windowContext)) return { | ||
if (ignoreElement.some(item => item === el) || isHidden(el, windowContext)) return { | ||
continue: true | ||
@@ -325,3 +323,3 @@ }; | ||
const foundChild = queryTabbableElement(el, selectors, iterationDirection, windowContext, false); | ||
const foundChild = queryTabbableElement(el, selectors, iterationDirection, ignoreElement, windowContext, false); | ||
if (foundChild) return { | ||
@@ -328,0 +326,0 @@ returnVal: foundChild |
@@ -52,5 +52,3 @@ const _tabbableSelectors = [ | ||
if (hasPassedVisitedElement) { | ||
if (ignoreElement.some((el) => el === child)) | ||
continue; | ||
const el = queryTabbableElement(child, tabbableSelectors, direction); | ||
const el = queryTabbableElement(child, tabbableSelectors, direction, ignoreElement); | ||
if (el) { | ||
@@ -74,5 +72,3 @@ return el; | ||
if (hasPassedVisitedElement) { | ||
if (ignoreElement.some((el) => el === child)) | ||
continue; | ||
const el = queryTabbableElement(child, tabbableSelectors, direction); | ||
const el = queryTabbableElement(child, tabbableSelectors, direction, ignoreElement); | ||
if (el) | ||
@@ -155,3 +151,3 @@ return el; | ||
}; | ||
export const queryTabbableElement = (el, selectors = _tabbableSelectors, iterationDirection = "forwards", windowContext = window, init = true) => { | ||
export const queryTabbableElement = (el, selectors = _tabbableSelectors, iterationDirection = "forwards", ignoreElement = [], windowContext = window, init = true) => { | ||
const queryChild = (el) => { | ||
@@ -179,3 +175,4 @@ if (!el.matches(selectors)) | ||
if (init) { | ||
if (isHidden(el, windowContext)) | ||
if (ignoreElement.some((item) => item === el) || | ||
isHidden(el, windowContext)) | ||
return null; | ||
@@ -187,3 +184,3 @@ const { el: elResult, matched, windowContext: windowContextResult, } = queryChild(el); | ||
windowContext = windowContextResult || windowContext; | ||
return queryTabbableElement(el, selectors, iterationDirection, windowContext, false); | ||
return queryTabbableElement(el, selectors, iterationDirection, ignoreElement, windowContext, false); | ||
} | ||
@@ -196,3 +193,4 @@ const shadowRoot = el.shadowRoot; | ||
const iterateChild = (el) => { | ||
if (isHidden(el, windowContext)) | ||
if (ignoreElement.some((item) => item === el) || | ||
isHidden(el, windowContext)) | ||
return { | ||
@@ -207,3 +205,3 @@ continue: true, | ||
} | ||
const foundChild = queryTabbableElement(el, selectors, iterationDirection, windowContext, false); | ||
const foundChild = queryTabbableElement(el, selectors, iterationDirection, ignoreElement, windowContext, false); | ||
if (foundChild) | ||
@@ -210,0 +208,0 @@ return { returnVal: foundChild }; |
@@ -33,3 +33,3 @@ declare type GetNextTabbableElement = { | ||
export declare const getNextTabbableElement: ({ from: _from, stopAtRootElement: stopAtRootElement, ignoreElement, allowSelectors, direction, wrap, }: GetNextTabbableElement) => HTMLElement; | ||
export declare const queryTabbableElement: (el: Element, selectors?: string, iterationDirection?: "forwards" | "backwards", windowContext?: Window, init?: boolean) => HTMLElement | null; | ||
export declare const queryTabbableElement: (el: Element, selectors?: string, iterationDirection?: "forwards" | "backwards", ignoreElement?: HTMLElement[], windowContext?: Window, init?: boolean) => HTMLElement | null; | ||
export {}; |
{ | ||
"name": "solid-dismiss", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"homepage": "https://aquaductape.github.io/solid-dismiss/", | ||
@@ -5,0 +5,0 @@ "description": "Handles \"click outside\" behavior for popup menu. Closing is triggered by click/focus outside of popup element or pressing \"Escape\" key.", |
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
329998
4479