Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Offer expiration dropdown moving on scroll #10964

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading