From 55a7d252e8aa2581aacebf8df79e0824a61660e3 Mon Sep 17 00:00:00 2001 From: "Spycher, Roman" Date: Thu, 16 Jul 2026 15:50:20 +0200 Subject: [PATCH] Fixed six-file-upload-success being emitted twice on file drop in Angular applications using Zone.js --- docs/changelog.md | 5 +++++ .../six-file-upload/six-file-upload.tsx | 16 ++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/docs/changelog.md b/docs/changelog.md index 9cf2492dd..1db5dcc8d 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). ## Upcoming +### Fixed + +- `six-file-upload`: Fixed six-file-upload-success being emitted twice on file drop in Angular + applications using Zone.js. + ## 5.5.0 - 2026-07-03 - `six-breadcrumbs` new style aligned with design guidelines. Added `size` interface property. diff --git a/libraries/ui-library/src/components/six-file-upload/six-file-upload.tsx b/libraries/ui-library/src/components/six-file-upload/six-file-upload.tsx index a10e58b60..ec3f467c6 100644 --- a/libraries/ui-library/src/components/six-file-upload/six-file-upload.tsx +++ b/libraries/ui-library/src/components/six-file-upload/six-file-upload.tsx @@ -68,28 +68,28 @@ export class SixFileUpload { /** Triggers when an uploaded file doesn't match MIME type or max file size. */ @Event({ eventName: 'six-file-upload-failure' }) failure!: EventEmitter; - @Listen('dragenter', { capture: false }) + @Listen('dragenter', { capture: false, passive: false }) dragenterHandler() { if (!this.disabled) { this.isOver = true; } } - @Listen('dragover', { capture: false }) + @Listen('dragover', { capture: false, passive: false }) dragoverHandler() { if (!this.disabled) { this.isOver = true; } } - @Listen('dragleave', { capture: false }) + @Listen('dragleave', { capture: false, passive: false }) dragleaveHandler() { if (!this.disabled) { this.isOver = false; } } - @Listen('drop', { capture: false }) + @Listen('drop', { capture: false, passive: false }) dropHandler(event: DragEvent) { if (!this.disabled) { this.isOver = false; @@ -157,16 +157,16 @@ export class SixFileUpload { componentDidLoad() { ['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => { - this.host.addEventListener(eventName, this.preventDefaults, false); - document.body.addEventListener(eventName, this.preventDefaults, false); + this.host.addEventListener(eventName, this.preventDefaults, { capture: false, passive: false }); + document.body.addEventListener(eventName, this.preventDefaults, { capture: false, passive: false }); }); this.host.shadowRoot?.addEventListener('slotchange', this.handleSlotChange); } disconnectedCallback() { ['dragenter', 'dragover', 'dragleave', 'drop'].forEach((eventName) => { - this.host.removeEventListener(eventName, this.preventDefaults, false); - document.body.removeEventListener(eventName, this.preventDefaults, false); + this.host.removeEventListener(eventName, this.preventDefaults, { capture: false }); + document.body.removeEventListener(eventName, this.preventDefaults, { capture: false }); }); this.host.shadowRoot?.removeEventListener('slotchange', this.handleSlotChange); }