refactor(frontend): utility dedup, component splits, dead code removal (#193–#200) #241

Merged
marcel merged 19 commits from refactor/issues-193-200 into main 2026-04-15 15:23:16 +02:00
2 changed files with 13 additions and 0 deletions
Showing only changes of commit 4446e80875 - Show all commits

View File

@@ -51,6 +51,18 @@ describe('clickOutside action', () => {
expect(fired).toBe(false);
});
it('does not dispatch clickoutside when event.defaultPrevented is true', () => {
const node = makeNode();
const outside = makeNode();
let fired = false;
node.addEventListener('clickoutside', () => (fired = true));
clickOutside(node);
const event = new MouseEvent('click', { bubbles: true, cancelable: true });
event.preventDefault();
outside.dispatchEvent(event);
expect(fired).toBe(false);
});
it('removes the listener on destroy', () => {
const node = makeNode();
const outside = makeNode();

View File

@@ -5,6 +5,7 @@ export function clickOutside(node: HTMLElement): { destroy: () => void } {
}
}
// Capture phase (true) ensures this fires before any child stopPropagation() calls.
document.addEventListener('click', handleClick, true);
return {