From 2533cdba3de7d562d497f923489ba7d7eb62cac7 Mon Sep 17 00:00:00 2001 From: KumJungMin Date: Sun, 10 Nov 2024 17:53:36 +0900 Subject: [PATCH] fix: prevent event propagation when clicking overlay in appendTo select mode --- packages/primevue/src/treeselect/TreeSelect.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/primevue/src/treeselect/TreeSelect.vue b/packages/primevue/src/treeselect/TreeSelect.vue index 67d2a5fa9..0be9818d3 100644 --- a/packages/primevue/src/treeselect/TreeSelect.vue +++ b/packages/primevue/src/treeselect/TreeSelect.vue @@ -88,6 +88,7 @@ @node-collapse="$emit('node-collapse', $event)" @node-select="onNodeSelect" @node-unselect="onNodeUnselect" + @click.stop :level="0" :unstyled="unstyled" :pt="ptm('pcTree')" @@ -133,13 +134,13 @@ import { isEmpty, isNotEmpty } from '@primeuix/utils/object'; import { ZIndex } from '@primeuix/utils/zindex'; import { ConnectedOverlayScrollHandler, UniqueComponentId } from '@primevue/core/utils'; import ChevronDownIcon from '@primevue/icons/chevrondown'; +import TimesIcon from '@primevue/icons/times'; import Chip from 'primevue/chip'; import OverlayEventBus from 'primevue/overlayeventbus'; import Portal from 'primevue/portal'; import Ripple from 'primevue/ripple'; import Tree from 'primevue/tree'; import BaseTreeSelect from './BaseTreeSelect.vue'; -import TimesIcon from '@primevue/icons/times'; export default { name: 'TreeSelect', @@ -228,14 +229,14 @@ export default { if (event.target.tagName === 'INPUT' || event.target.getAttribute('data-pc-section') === 'clearicon' || event.target.closest('[data-pc-section="clearicon"]')) { return; - } else if (!this.disabled && (!this.overlay || !this.overlay.contains(event.target))) { + } else if (!this.overlay || !this.overlay.contains(event.target)) { if (this.overlayVisible) this.hide(); else this.show(); focus(this.$refs.focusInput); } }, - onClearClick(event) { + onClearClick() { this.onSelectionChange(null); }, onSelectionChange(keys) {