-
-
Notifications
You must be signed in to change notification settings - Fork 78.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popover setContent closes Popover after being opened with .show() or on hover #37206
Comments
Lines 338 to 344 in 24f6e27
I'm not sure it is possible to set a new content without disposing the popper when it is already shown. But I'm curious. A popover is linked to an action, so what would be the use case where we have an opened popover which must be updated on the fly? In other words, why the popover is not shown with the right content in the first place? |
Well, it's only shown if it was already open: |
Yep OK. Read it too quickly. I see your point. |
quick answer: During the first effort, popper wasn't able to render the changed content properly. So the only way was to close it and re-render it |
Okay, so I replaced instance.tip.querySelector('.popover-body').innerHTML = 'New Content'
instance.update() That could be a fix in bootstrap as well, but I don't have the time right now to delve deep enough into the codebase to do a proper PR |
Prerequisites
Describe the issue
Whenever I update the content of a popover (e.g. after loading the final content from an API) after having opened the Popover manually it closes again after calling setContent().
Reduced test cases
https://codepen.io/dkhalil/pen/eYreLbQ
What operating system(s) are you seeing the problem on?
Windows
What browser(s) are you seeing the problem on?
Chrome
What version of Bootstrap are you using?
v5.2.1
The text was updated successfully, but these errors were encountered: