@cqa-lib/cqa-ui 1.1.462 → 1.1.463
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2533,9 +2533,14 @@ class DynamicSelectFieldComponent {
|
|
|
2533
2533
|
if (this.hostEl?.nativeElement && this.hostEl.nativeElement.contains(target)) {
|
|
2534
2534
|
return;
|
|
2535
2535
|
}
|
|
2536
|
-
//
|
|
2536
|
+
// Use composedPath() to capture the event dispatch path at the time of the click,
|
|
2537
|
+
// before any DOM mutations triggered by selection-change handlers (e.g. options list
|
|
2538
|
+
// rebuild). Without this, when an option is un-checked the consumer may reassign
|
|
2539
|
+
// config (new reference) which causes Angular to re-render and detach the original
|
|
2540
|
+
// click-target node, making el.contains(target) return false even for in-panel clicks.
|
|
2541
|
+
const eventPath = (event.composedPath ? event.composedPath() : []);
|
|
2537
2542
|
const panelEls = Array.from(document.querySelectorAll('.mat-select-panel'));
|
|
2538
|
-
const clickInsidePanel = panelEls.some((el) => el.contains(target));
|
|
2543
|
+
const clickInsidePanel = panelEls.some((el) => el.contains(target) || eventPath.includes(el));
|
|
2539
2544
|
if (clickInsidePanel) {
|
|
2540
2545
|
return;
|
|
2541
2546
|
}
|