mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-11-15 17:21:38 +03:00
B: Do not close dropdown on click on interactive child
This commit is contained in:
parent
99312f25ee
commit
1e17a671da
|
|
@ -7,7 +7,16 @@ export function useDropdown() {
|
|||
const ref = useRef<HTMLDivElement>(null);
|
||||
|
||||
function handleBlur(event: React.FocusEvent<HTMLDivElement>) {
|
||||
if (ref.current?.contains(event.relatedTarget as Node)) {
|
||||
const nextTarget = event.relatedTarget as Node | null;
|
||||
if (nextTarget && ref.current?.contains(nextTarget)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Keep open when focus moves into a popover (e.g., ComboBox menu rendered via portal)
|
||||
if (
|
||||
nextTarget instanceof Element &&
|
||||
(nextTarget.closest("[data-slot='popover-content']") || nextTarget.closest("[data-slot='popover-trigger']"))
|
||||
) {
|
||||
return;
|
||||
}
|
||||
setIsOpen(false);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user