solid-dismiss
Advanced tools
Comparing version 1.6.7 to 1.6.71
import { dismissStack } from "../global/dismissStack"; | ||
import { globalState } from "../global/globalEvents"; | ||
import { checkThenClose } from "../utils/checkThenClose"; | ||
import { isObjectLiteral } from "../utils/isObjectLiteral"; | ||
import { queryElement } from "../utils/queryElement"; | ||
@@ -65,3 +66,7 @@ import { addEventsToActiveMountedPopup, getActiveMountedPopupFromSafeList, removeEventsOnActiveMountedPopup, } from "./thirdPartyPopup"; | ||
setTimeout(() => { | ||
el.focus({ preventScroll: el === state.menuPopupEl }); | ||
const preventScroll = isObjectLiteral(focusElementOnOpen) | ||
? // @ts-ignore | ||
!!focusElementOnOpen.preventScroll | ||
: el === state.menuPopupEl; | ||
el.focus({ preventScroll }); | ||
focusedMenuBtn.el = null; | ||
@@ -68,0 +73,0 @@ }); |
import { getMenuButton } from "../local/menuButton"; | ||
import { isObjectLiteral } from "./isObjectLiteral"; | ||
import { getNextTabbableElement } from "./tabbing"; | ||
@@ -11,2 +12,8 @@ export const queryElement = (state, { inputElement, type, subType, }) => { | ||
if (type === "focusElementOnOpen") { | ||
if (isObjectLiteral(inputElement)) { | ||
return queryElement(state, { | ||
inputElement: inputElement.target, | ||
type: "focusElementOnOpen", | ||
}); | ||
} | ||
if (inputElement === "none") | ||
@@ -26,2 +33,8 @@ return null; | ||
} | ||
if (typeof inputElement === "object") { | ||
return queryElement(state, { | ||
inputElement: inputElement.target, | ||
type: "focusElementOnOpen", | ||
}); | ||
} | ||
const component = inputElement(); | ||
@@ -28,0 +41,0 @@ if (typeof component === "string") { |
@@ -75,3 +75,6 @@ import { Accessor, JSX, ParentComponent } from "solid-js"; | ||
*/ | ||
focusElementOnOpen?: "menuPopup" | "firstChild" | "none" | JSX.Element | (() => JSX.Element); | ||
focusElementOnOpen?: "menuPopup" | "firstChild" | "none" | JSX.Element | (() => JSX.Element) | { | ||
target: "menuPopup" | "firstChild" | "none" | JSX.Element | (() => JSX.Element); | ||
preventScroll?: boolean; | ||
}; | ||
/** | ||
@@ -78,0 +81,0 @@ * |
{ | ||
"name": "solid-dismiss", | ||
"version": "1.6.7", | ||
"version": "1.6.71", | ||
"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 too big to display
Sorry, the diff of this file is not supported yet
350616
49
4724