fix: DatePicker/Select fix outsideClickListener inside web components

pull/7160/head
Andreas Baumgartner 2025-01-29 10:45:27 +01:00
parent 07c5dc2ef7
commit 2323dd92f8
2 changed files with 4 additions and 2 deletions

View File

@ -1096,7 +1096,8 @@ export default {
}
},
isOutsideClicked(event) {
return !(this.$el.isSameNode(event.target) || this.isNavIconClicked(event) || this.$el.contains(event.target) || (this.overlay && this.overlay.contains(event.target)));
const composedPath = event.composedPath();
return !(this.$el.isSameNode(event.target) || this.isNavIconClicked(event) || composedPath.includes(this.$el) || composedPath.includes(this.overlay));
},
isNavIconClicked(event) {
return (this.previousButton && (this.previousButton.isSameNode(event.target) || this.previousButton.contains(event.target))) || (this.nextButton && (this.nextButton.isSameNode(event.target) || this.nextButton.contains(event.target)));

View File

@ -727,7 +727,8 @@ export default {
bindOutsideClickListener() {
if (!this.outsideClickListener) {
this.outsideClickListener = (event) => {
if (this.overlayVisible && this.overlay && !this.$el.contains(event.target) && !this.overlay.contains(event.target)) {
const composedPath = event.composedPath();
if (this.overlayVisible && this.overlay && !composedPath.includes(this.$el) && !composedPath.includes(this.overlay)) {
this.hide();
}
};