5.2.0 regression: tooltips never close when they are initialized using as `selector` option the attribute `title`
See original GitHub issuePrerequisites
- I have searched for duplicate or closed issues
- I have validated any HTML to avoid common problems
- I have read the contributing guidelines
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:
<div id="btn-box" class="btn-group m-5">
<button class="btn btn-lg btn-primary" title="Label 1">Button 1</button>
<button class="btn btn-lg btn-secondary" title="Label 2">Button 2</button>
</div>
JavaScript:
new bootstrap.Tooltip('#btn-box', {
selector: '[title]'
});
Reduced test cases
The tooltip is hidden when the mouse leaves the element | Version | selector option |
CodePen link |
---|---|---|---|
✔️ | 5.1.3 | ❌ | https://codepen.io/BrokenSourceCode/pen/zYWzZNJ |
✔️ | 5.1.3 | ✔️ | https://codepen.io/BrokenSourceCode/pen/vYRZxNo |
✔️ | 5.2.0 | ❌ | https://codepen.io/BrokenSourceCode/pen/GRxEWWp |
❌ | 5.2.0 | ✔️ | https://codepen.io/BrokenSourceCode/pen/ExEXWPp |
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.0
Issue Analytics
- State:
- Created a year ago
- Comments:13 (6 by maintainers)
Top Results From Across the Web
Changelog | Docs - TinyMCE
Fixed a regression that caused block wrapper formats to apply and remove incorrectly when using a collapsed selection with multiple words.
Read more >Releases - MudBlazor - Blazor Component Library
- Reverted MudAutoComplete close on blur from MudBlazor 5.0.12 that did not select the selected option. #MudBlazor 5.0.12. - MudTextField Added missing right ......
Read more >Tooltips and Popovers not working in Bootstrap 5
In current implementation, the code to enable tooltips and popovers everywhere is not run by default. You have to run it yourself, ...
Read more >Changelog - Cypress Documentation
Fixed a regression introduced in the Electron browser in Cypress 10.8.0 where the CYPRESS_EVERY_NTH_FRAME environment variable was not being set appropriately ...
Read more >Bootstrap Tooltips - examples & tutorial
Tooltips are opt-in for performance reasons, so you must initialize them yourself. Tooltips with zero-length titles are never displayed. Specify container: ' ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@GeoSot said it won’t be fixed, because this is a bad practice. See https://github.com/twbs/bootstrap/issues/36813#issuecomment-1195141449. You can use another selector like
[data-bs-toggle="tooltip"]
or as well use your own custom class. The solution below will show you how to fix your issue.HTML:
JavaScript:
Furthermore, @GeoSot, I suggest adding a note in the documentation of the
selector
option to state that thetitle
attribute MUST NOT be used as selector.Thanks @BrokenSourceCode !
Turned out quite easy to fix… just grep the js html templates for
title=
and add a target to use in a selector,data-bs-tooltip
in my case.