Skip to content

Commit

Permalink
Merge pull request #10964 from Jarsen136/issue-10951
Browse files Browse the repository at this point in the history
fix: Offer expiration dropdown moving on scroll
  • Loading branch information
vikiival authored Sep 11, 2024
2 parents 8ec7c24 + b03b640 commit 76bdc5a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/offer/OfferExpirationSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
:triggers="['click']"
position="bottom-left"
append-to-body
close-menu-on-move
class="w-full"
menu-class="!min-w-[8rem]"
>
Expand Down
14 changes: 13 additions & 1 deletion libs/ui/src/components/NeoDropdown/NeoDropdown.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script>
import { ODropdown } from '@oruga-ui/oruga-next'
import { useElementBounding } from '@vueuse/core'
export default {
mixins: [ODropdown],
Expand All @@ -12,7 +13,10 @@ export default {
type: Boolean,
default: false,
},
closeMenuOnMove: {
type: Boolean,
default: false,
},
position: {
type: String,
validator: (value) => {
Expand Down Expand Up @@ -90,6 +94,9 @@ export default {
else {
this.autoPosition = this.position
}
if (this.closeMenuOnMove) {
watch(useElementBounding(this.$refs.trigger).top, this.onTriggerMove)
}
},
onBeforeUnmount() {
window.removeEventListener('resize', this.calcDropdownPosition)
Expand All @@ -105,6 +112,11 @@ export default {
: 'left'
this.autoPosition = this.position.replace('auto', side)
},
onTriggerMove() {
if (this.isActive) {
this.isActive = false
}
},
},
}
</script>
Expand Down

0 comments on commit 76bdc5a

Please sign in to comment.