mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 21:41:09 +02:00
fix(shared-ui): block click event after drag to prevent detail view opening
After a successful drag-and-drop, the browser fires a click event on the source element. This was opening the detail view overlay instead of completing the drop. Now a one-time click blocker is added after drag ends to swallow the spurious click. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
9b8814ea37
commit
a15b027e96
1 changed files with 9 additions and 0 deletions
|
|
@ -108,6 +108,15 @@ export function dragSource(node: HTMLElement, options: DragSourceOptions) {
|
|||
})
|
||||
);
|
||||
endDrag();
|
||||
// Block the click event that fires after pointerup — prevents
|
||||
// opening detail views when dropping an item.
|
||||
const blocker = (ev: Event) => {
|
||||
ev.stopPropagation();
|
||||
ev.preventDefault();
|
||||
};
|
||||
node.addEventListener('click', blocker, { capture: true, once: true });
|
||||
// Safety: remove blocker after a tick in case click doesn't fire
|
||||
setTimeout(() => node.removeEventListener('click', blocker, { capture: true }), 0);
|
||||
}
|
||||
cleanup();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue