diff --git a/Parts/DropDown.js b/Parts/DropDown.js index e22faae..0fa96fc 100644 --- a/Parts/DropDown.js +++ b/Parts/DropDown.js @@ -27,12 +27,18 @@ let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button const [popoverDropdownRef, setPopoverDropdownRef] = React.useState(null); const { styles, attributes, update } = usePopper(btnDropdownRef, popoverDropdownRef, - { placement: placement ?? "bottom", ...popper }); + { + placement: placement ?? "bottom", + strategy: "fixed", + ...popper + }); const openDropdownPopover = async () => { setDropdownPopoverShow(true); - console.log(update) - await update(); + + if (update != null) { + await update(); + } onValueChanged && onValueChanged(true); }; @@ -43,7 +49,7 @@ let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button function handleOutsideClick(event) { let node = popoverDropdownRef; - if (node && !node?.contains(event.target)) { + if (node && !node?.contains(event.target) && !btnDropdownRef?.contains(event.target)) { closeDropdownPopover(); } } @@ -60,11 +66,11 @@ let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button document.removeEventListener("click", handleOutsideClick) }; }); - - useImperativeHandle(ref, () => ({ - openDropdownPopover, - closeDropdownPopover - })) + /* + useImperativeHandle(ref, () => ({ + openDropdownPopover, + closeDropdownPopover + }))*/ let childrenWithProps = React.Children.map(children, (item) => { if (!item) @@ -88,23 +94,24 @@ let Dropdown = React.forwardRef(({ children, dropdownCss, onValueChanged, button > {button} - {dropdownPopoverShow && -