In using the "triggerAutoclose" option that closes opened popovers on document click, it works the first time, but for every time after that, if closes popovers the second they are opened, giving it a flicker type effect.
Currently the script checks if a $currentPopover exists, and if so, to hide it. This doesn't make sense if the current popover is the open popover.
So to resolve, we just need to change line 104 of bootstrap.js from:
if ($currentPopover.length) {
to:
if (!$currentPopover.is(this)) {
and it will work.
I've tested this fix with multiple popovers and it works fine.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | popover_option-2376405-6.patch | 5.03 KB | markhalliwell |
Comments
Comment #1
markhalliwellPlease create a patch.
Comment #2
jurriaanroelofs commentedPatch attached.
To reproduce reported problem:
1. Turn on popover > autoclose option
2. Add popover button with click trigger:
<a tabindex="0" class="btn btn-lg btn-danger" role="button" data-toggle="popover" data-trigger="click" title="Dismissible popover" data-content="And here's some amazing content. It's very engaging. Right?">Dismissible popover</a>3. Click to open popover. Click outside to hide. Second click will do nothing. Third click will quickly show and hide the popover, because the old code had a logic of on-show-popover: hide popover. Subsequent clicks will also not show the popover.
Comment #3
markhalliwellRemoving this defeats the whole point of the setting.
I actually ran into this issue in the 8.x-3.x branch and refactored this entire behavior. This code should be backported to 7.x-3.x:
http://cgit.drupalcode.org/bootstrap/tree/js/popover.js
Comment #4
jurriaanroelofs commentedI actually wanted to make another patch that scopes the behavior even broader. I also have popovers that are completely dynamically created (Because they contain html). In that case I will add a class .has-bootstrap-popover and broaden the scope like this:
Is that not a direction you want to take? If not than I will just put these behaviors in a subtheme and let them co-exist with the basetheme autoclose.
Comment #5
markhalliwellI'm not entirely sure what you mean by "broader". Regardless, no, the direction I'd like to take is what I stated in #3.
Since this "feature" is a setting, it can easily be disabled so a sub-theme can implement whatever custom behavior it wants to.
Comment #6
markhalliwellHere is, more or less, a direct backport of the 8.x JS.
Comment #9
joseph.olstadThanks, including this in my make file.
Comment #10
joseph.olstadHmm, my make couldn't patch this for some reason.
trying to apply to 7.x-3.14
Unable to patch bootstrap with popover_option-2376405-6.patch.Comment #11
joseph.olstaduse this patch instead
Comment #12
joseph.olstadnevermind, 3.14 already has this, PEBKAC issue