10004 tasks will not delete in people view (#10039)
Fixes #10004 - Fixed `useListenClickOutside` which wasn't working with `excludeClassNames` for `comparePixels` mode - Added `emitCloseEvent` parameter to the `closeRightDrawer` function because closing the right drawer after deleting a note or a task was triggering an update after the deletion. This bug was only for the old version of the command menu.
This commit is contained in:
@ -157,26 +157,26 @@ export const useListenClickOutside = <T extends Element>({
|
||||
.getLoadable(getClickOutsideListenerMouseDownHappenedState)
|
||||
.getValue();
|
||||
|
||||
if (mode === ClickOutsideMode.compareHTMLRef) {
|
||||
const clickedElement = event.target as HTMLElement;
|
||||
let isClickedOnExcluded = false;
|
||||
let currentElement: HTMLElement | null = clickedElement;
|
||||
const clickedElement = event.target as HTMLElement;
|
||||
let isClickedOnExcluded = false;
|
||||
let currentElement: HTMLElement | null = clickedElement;
|
||||
|
||||
while (currentElement) {
|
||||
const currentClassList = currentElement.classList;
|
||||
while (currentElement) {
|
||||
const currentClassList = currentElement.classList;
|
||||
|
||||
isClickedOnExcluded =
|
||||
excludeClassNames?.some((className) =>
|
||||
currentClassList.contains(className),
|
||||
) ?? false;
|
||||
isClickedOnExcluded =
|
||||
excludeClassNames?.some((className) =>
|
||||
currentClassList.contains(className),
|
||||
) ?? false;
|
||||
|
||||
if (isClickedOnExcluded) {
|
||||
break;
|
||||
}
|
||||
|
||||
currentElement = currentElement.parentElement;
|
||||
if (isClickedOnExcluded) {
|
||||
break;
|
||||
}
|
||||
|
||||
currentElement = currentElement.parentElement;
|
||||
}
|
||||
|
||||
if (mode === ClickOutsideMode.compareHTMLRef) {
|
||||
const clickedOnAtLeastOneRef = refs
|
||||
.filter((ref) => !!ref.current)
|
||||
.some((ref) => ref.current?.contains(event.target as Node));
|
||||
@ -244,7 +244,8 @@ export const useListenClickOutside = <T extends Element>({
|
||||
!clickedOnAtLeastOneRef &&
|
||||
!isMouseDownInside &&
|
||||
isListening &&
|
||||
hasMouseDownHappened;
|
||||
hasMouseDownHappened &&
|
||||
!isClickedOnExcluded;
|
||||
|
||||
if (CLICK_OUTSIDE_DEBUG_MODE) {
|
||||
// eslint-disable-next-line no-console
|
||||
@ -255,6 +256,7 @@ export const useListenClickOutside = <T extends Element>({
|
||||
isMouseDownInside,
|
||||
isListening,
|
||||
hasMouseDownHappened,
|
||||
isClickedOnExcluded,
|
||||
hotkeyScope,
|
||||
enabled,
|
||||
event,
|
||||
|
||||
Reference in New Issue
Block a user