Skip to content
Open
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
24 changes: 21 additions & 3 deletions client/src/js/app/components/navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
<router-link
to=""
class="tw-relative navbar-item"
@mouseover.native="showProposalMenu=true"
@mouseover.native="handleMouseOver"
@mouseleave.native="showProposalMenu=false"
@click.native="showProposalMenu=false"
@click.native="handleClick"
>
<p class="tw-text-xs">
<i
Expand Down Expand Up @@ -152,9 +152,10 @@ export default {
showHelpMenu: false,
// If hover over proposal menu flag
showProposalMenu: false,
lastHoverOpenAt: 0,
hoverGraceTimeMs: 100,
}
},

computed: {
proposal: function() {
return this.$store.getters['proposal/currentProposal']
Expand Down Expand Up @@ -199,6 +200,23 @@ export default {
e.stopPropagation()
}
},

handleMouseOver() {
if (!this.showProposalMenu) {
this.lastHoverOpenAt = Date.now()
}
this.showProposalMenu = true
},

handleClick() {
// If the menu was opened by a very recent hover, ignore the click that would close it.
if ((Date.now() - this.lastHoverOpenAt) < this.hoverGraceTimeMs) {
return
}
// Otherwise toggle as normal
this.showProposalMenu = !this.showProposalMenu

},
}
}
</script>
Expand Down
Loading