angular-ui / bootstrap

PLEASE READ THE PROJECT STATUS BELOW. Native AngularJS (Angular) directives for Bootstrap. Smaller footprint (20kB gzipped), no 3rd party JS dependencies (jQuery, bootstrap JS) required. Please read the README.md file before submitting an issue!
http://angular-ui.github.io/bootstrap/
MIT License
14.28k stars 6.73k forks source link

Popover randomly closes immediately after opening when using `popover-is-open` #6635

Closed andrastothtw closed 7 years ago

andrastothtw commented 7 years ago

Bug description:

When setting value to popover-is-open popover shows and hides immediately. But not always.

Steps to reproduce the issue:

  1. I have a callback from an external module when its input receives focus (property of angucomplete-alt version 3.0.0) focus-in="vm.autocompleteFocus(true)"
  2. autocomplete focus sets tooltipIsOpen to true:
    autocompleteFocus(value) { this.tooltipIsOpen = value; }
  3. pop-over detects changes and...
    popover-is-open="vm.tooltipIsOpen"
    popover-trigger="none"

Result:

Tooltip opens and closes.

What I tried to overcome it

When I created a setter and added a log message inside it turned out, that pop-over set tooltipIsOpen's value at least once but sometimes twice.

I then tried to overcome 2-way binding with popover-is-open="!!vm.tooltipIsOpen", but it did not work.

I noted one more thing; when I added a breakpoint to the first line of this function the thing started to work as expected:

function assignIsOpen(isOpen) {
  if (isOpenParse && angular.isFunction(isOpenParse.assign)) {
    isOpenParse.assign(scope, isOpen);
  }
}

Version of Angular, UIBS, and Bootstrap

Angular: 1.5.11

UIBS: 2.5.0

Bootstrap: 3.3.7

andrastothtw commented 7 years ago

Solved: never forget to put '' around none in popover-trigger="'none'" I was doing it with popover-trigger="none" and it caused the problems.

prathik457 commented 6 years ago

Thank you @andrastothtw for this. Spent 3 hours banging my head over this issue. You saved the day.