This commit is contained in:
dap
2025-02-26 09:17:03 +08:00
20 changed files with 811 additions and 10 deletions

View File

@@ -1,8 +1,12 @@
/**
* Returns the parent node of the given element or the document body if the element is not provided.it
* If the node is holding inside a form, return the form element,
* otherwise return the parent node of the given element or
* the document body if the element is not provided.
*/
export function getPopupContainer(node?: HTMLElement): HTMLElement {
return (node?.parentNode as HTMLElement) ?? document.body;
return (
node?.closest('form') ?? (node?.parentNode as HTMLElement) ?? document.body
);
}
/**