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
5.2.0 regression: tooltips never close when they are initialized using as selector
option the attribute title
#36813
Comments
selector
optionselector
option
selector
optionselector
option
Same error for me. |
Apparently, it comes from 328f723. I'll try an explanation and @GeoSot will confirm or not. When the tooltip appears, In your case, I'd say you can use <div id="btn-box" class="btn-group m-5">
<button class="btn btn-lg btn-primary" data-bs-title="Label 1">Button 1</button>
<button class="btn btn-lg btn-secondary" data-bs-title="Label 2">Button 2</button>
</div> new bootstrap.Tooltip('#btn-box', {
selector: '[data-bs-title]'
}) |
Well, I understand where the issue comes from with your explanation, and I also understand how I could use your workaround in my code, thanks. Will the code remains as it is now? Will there be no correction to fix this regression? |
You are right on this. It was something we had discussed together too, as the title was just left empty. @brokensourcecode I would prefer to not 'fix' this as it wasn't documented and of course is a bad practice to leave a blank attribute there. So you could, may use any other attr |
selector
optionselector
option the attribute title
No problem, I'll use another selector if you want to keep the code as it is. Perhaps it should be mentioned inside the Maybe like this: If a selector is provided, tooltip objects will be delegated to the specified targets. In practice, this is used to also apply tooltips to dynamically added DOM elements (jQuery.on support). See this issue and an informative example.
+ Note that this option cannot work with the <code>title</code> attribute (such as <code>[title]</code>), because the attribute is removed from the DOM by Bootstrap. |
@GeoScot It is documented in https://getbootstrap.com/docs/5.2/components/tooltips/#options and really does need to be fixed as its a regression from several previous releases. Dynamically generated content is pretty common now, and |
@aavmurphy Could you please copy and paste the part of the documentation? I really don't understand of which text you are talking about. But I agree with you that this is a good fallback solution, and also that this is a regression from the previous releases that accepted this behavior. |
@brokensourcecode Its in https://getbootstrap.com/docs/5.2/components/tooltips, |
See #36743 |
As the issue was labeled with |
Not fixed in 5.2.1 |
@GeoSot said it won't be fixed, because this is a bad practice. See #36813 (comment). You can use another selector like HTML: <!-- For `[data-bs-toggle="tooltip"]` selector. -->
<button class="btn btn-lg btn-info" title="Label 1" data-bs-toggle="tooltip">Button 1</button>
<button class="btn btn-lg btn-success" title="Label 2" data-bs-toggle="tooltip">Button 2</button>
<!-- For `.toggle-tooltip` selector. -->
<button class="btn btn-lg btn-warning toggle-tooltip" title="Label 3">Button 3</button>
<button class="btn btn-lg btn-danger toggle-tooltip" title="Label 4">Button 4</button> JavaScript: new bootstrap.Tooltip('body', {
selector: '[data-bs-toggle="tooltip"], .toggle-tooltip'
}); Furthermore, @GeoSot, I suggest adding a note in the documentation of the |
Thanks @brokensourcecode ! Turned out quite easy to fix... just grep the js html templates for |
Prerequisites
Describe the issue
Hi,
Since Bootstrap v5.2.0, the tooltips never close when they are initialized with
selector
option. It worked fine under Bootstrap v5.1.3. So, I think there is a regression.HTML:
JavaScript:
Reduced test cases
selector
optionWhat 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.0
The text was updated successfully, but these errors were encountered: