Skip to content

Commit

Permalink
momentarily halt close of dropdowns to allow clicks inside
Browse files Browse the repository at this point in the history
and importantly, whilst allowing the dropdown to autoclose
  • Loading branch information
13twelve committed Jan 6, 2025
1 parent 90da826 commit 053c544
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions frontend/js/components/Dropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,13 @@
}
}
if (!this.clickable) this.close()
else if (!this.$el.querySelector('[data-dropdown-content]').contains(target) && this.clickable) this.close()
// timeout so the click is not triggered directly
this.timer = setTimeout(() => {
this.timer = null
if (!this.clickable) this.close()
else if (!this.$el.querySelector('[data-dropdown-content]').contains(target) && this.clickable) this.close()
}, 1)
},
open: function (onShow) {
if (this.active) return
Expand Down

0 comments on commit 053c544

Please sign in to comment.