@eturnity/eturnity_reusable_components 9.31.2 → 9.31.3
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.
package/package.json
CHANGED
|
@@ -1055,10 +1055,16 @@
|
|
|
1055
1055
|
this.handleSetDropdownOffet()
|
|
1056
1056
|
this.refreshOptionLength()
|
|
1057
1057
|
if (!this.isFixedDropdownPosition) this.calculateSelectTopPosition()
|
|
1058
|
+
// Teleported menus live in <body>, so they aren't clipped by a
|
|
1059
|
+
// scrollable ancestor (e.g. the filter modal). Close on outside
|
|
1060
|
+
// scroll to avoid the menu floating free of its trigger.
|
|
1061
|
+
if (this.shouldUseTeleport)
|
|
1062
|
+
document.addEventListener('scroll', this.handleScrollClose, true)
|
|
1058
1063
|
// Deferred dropdown slot content mounts after initial open in some hosts.
|
|
1059
1064
|
this.$nextTick(() => this.refreshOptionLength())
|
|
1060
1065
|
} else {
|
|
1061
1066
|
this.$emit('on-dropdown-close')
|
|
1067
|
+
document.removeEventListener('scroll', this.handleScrollClose, true)
|
|
1062
1068
|
this.dropdownPosition.left = null
|
|
1063
1069
|
this.optionLengthCount = 0
|
|
1064
1070
|
if (this.animationFrameId) {
|
|
@@ -1139,6 +1145,7 @@
|
|
|
1139
1145
|
this.clickOutside,
|
|
1140
1146
|
CLICK_OUTSIDE_CAPTURE
|
|
1141
1147
|
)
|
|
1148
|
+
document.removeEventListener('scroll', this.handleScrollClose, true)
|
|
1142
1149
|
},
|
|
1143
1150
|
methods: {
|
|
1144
1151
|
getDropdownTopScrollYOffset() {
|
|
@@ -1162,6 +1169,14 @@
|
|
|
1162
1169
|
this.clearSearch()
|
|
1163
1170
|
this.isDropdownOpen = false
|
|
1164
1171
|
},
|
|
1172
|
+
handleScrollClose(e) {
|
|
1173
|
+
// Ignore scrolling within the menu itself (e.g. a long option list);
|
|
1174
|
+
// only close when a surrounding container scrolls. The menu is
|
|
1175
|
+
// teleported to <body>, so check the teleported dropdown element.
|
|
1176
|
+
const menuEl = this.$refs.dropdown?.$el
|
|
1177
|
+
if (menuEl && (menuEl === e.target || menuEl.contains(e.target))) return
|
|
1178
|
+
this.closeDropdown()
|
|
1179
|
+
},
|
|
1165
1180
|
clearSearch() {
|
|
1166
1181
|
this.textSearch = ''
|
|
1167
1182
|
this.searchChange('')
|