Make quick action dropdowns use capture phase of the event to trigger closure on outside click (#5414)

This commit is contained in:
rahulramesha 2024-08-26 14:40:11 +05:30 committed by GitHub
parent a0ed51c845
commit 890379b64f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 12 additions and 4 deletions

View file

@ -35,6 +35,7 @@ const CustomMenu = (props: ICustomMenuDropdownProps) => {
tabIndex,
closeOnSelect,
openOnHover = false,
useCaptureForOutsideClick = false,
} = props;
const [referenceElement, setReferenceElement] = React.useState<HTMLButtonElement | null>(null);
@ -88,7 +89,7 @@ const CustomMenu = (props: ICustomMenuDropdownProps) => {
}
};
useOutsideClickDetector(dropdownRef, closeDropdown);
useOutsideClickDetector(dropdownRef, closeDropdown, useCaptureForOutsideClick);
let menuItems = (
<Menu.Items className={cn("fixed z-10", menuItemsClassName)} static>

View file

@ -17,6 +17,7 @@ export interface IDropdownProps {
optionsClassName?: string;
placement?: Placement;
tabIndex?: number;
useCaptureForOutsideClick?: boolean;
}
export interface ICustomMenuDropdownProps extends IDropdownProps {