Commit 0c3dd925 by Netfan Committed by GitHub

fix: getPopupContainer will return closet form first (#5612)

1 parent d33261d0
/** /**
* 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 { export function getPopupContainer(node?: HTMLElement): HTMLElement {
return (node?.parentNode as HTMLElement) ?? document.body; return (
node?.closest('form') ?? (node?.parentNode as HTMLElement) ?? document.body
);
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!