faulknercs / Knockstrap

Knockout bindings to twitter bootstrap 3
faulknercs.github.io/Knockstrap/
MIT License
142 stars 37 forks source link

Popover focus trigger behavior with 'hasFocus' #64

Closed Moghul closed 3 years ago

Moghul commented 6 years ago

I have a popover on a div with a focus trigger. The same div has a hasFocus binding to an observable in my js.

If I set the observable to true, the popover comes up. If I set it to false again, the popover doesn't go away.

<div data-bind="hasFocus: canShowPopover, popover: {options: {placement: 'bottom', content: callToFunctionThatMakesTheContent, html: true, trigger: 'focus', container: 'body'}}"></div>

It doesn't matter how you update the observable, you can do it from the console.

faulknercs commented 3 years ago

Thanks for the report! Looks like compatibility issue between bootsrap's and knockout's 3.0.* focus event handling (and only when knockout is loaded before jQuery). But anyway it isn't reproducible with knockout >= 3.1.0. Please, see this example: https://jsfiddle.net/faulknercs/znqy45ob/