Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

Commit

Permalink
Enhance popovers to allow hovering over them (#114)
Browse files Browse the repository at this point in the history
It is hard to interact with popovers and tooltips, since they disappear
once hovered over.

Let's add a new attribute 'hoverable' to popoverMixins.

If true, once the popover is loaded the popover itself will listen to
the hover (mouseenter and mouseleave) events just like a trigger.
  • Loading branch information
openorclose authored and yamgent committed Jul 17, 2019
1 parent 48342dd commit 20a48d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/utils/popoverMixins.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ export default {
},
id: {
type: String
},
hoverable: {
type: Boolean,
default: false
}
},
data () {
Expand All @@ -53,6 +57,9 @@ export default {
},
titleRendered () {
return md.renderInline(this.title)
},
hoverableBool() {
return toBoolean(this.hoverable)
}
},
methods: {
Expand Down Expand Up @@ -131,6 +138,9 @@ export default {
}
// temporary fix for popover going off screen - end

if (this.hoverableBool) {
$(this.$refs.popover).on('mouseleave mouseenter', this.toggle)
}
}, 20)
},
calculateOffset (trigger, popover) {
Expand Down

0 comments on commit 20a48d5

Please sign in to comment.