Tooltip/popover: data-bs-title and data-bs-content are reformatted or throw ("9.90" shows as "9.9", empty title throws)
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- javascript
- Domain
- frontend
Research direction
The data-API reads data-bs-title and data-bs-content through Manipulator.normalizeData, and the reporter places the fix in Tooltip._getConfig. Start by reproducing the cases in the reduced test case (9.90, empty title, after) with the standard init loop, then check the tooltip tests. Done means text attributes render exactly as written and a bad element no longer stops later tooltips from initializing. Settle the data-bs-content="null" behaviour change with maintainers before opening a pull request.
Written by the indexing model from the issue text.
Description
Prerequisites
- 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
Tooltip and popover pass data-bs-title / data-bs-content through the data-API type conversion (Manipulator.normalizeData: numbers, "null", JSON.parse). For free text that changes or rejects what the author wrote. On the shipped 5.3.8 bundle and on main:
data-bs-title="9.90" -> shows "9.9"
data-bs-title="2.0" -> shows "2"
data-bs-title="1e3" -> shows "1000"
data-bs-title='"quoted"' -> shows quoted (quotes removed)
data-bs-title="" -> throws: Option "title" provided type "null" but expected type "(string|element|function)"
data-bs-title="null" -> throws (same)
data-bs-title="[1,2]" -> throws: provided type "array"
With the documented init loop ([...tooltipTriggerList].map(el => new bootstrap.Tooltip(el))), one throwing element also stops the tooltips after it from being initialized. An empty title from a template with a missing value is enough.
This looks like the remaining root cause of #41925 (booleans, fixed on main by #42548) and #22057 (numbers): title and content are text, so they could be read as written instead of normalized. I have a patch for main that does that in Tooltip._getConfig (with tests; the unit suite passes). One behaviour change to note: data-bs-content="null" would then show the text "null" instead of no content. Happy to open a PR against main and/or v5-dev if you want it.
Reproduction: <button data-bs-toggle="tooltip" data-bs-title="9.90">x</button> plus the standard init loop, then hover.
Disclosure: this was found, reproduced and patched by an AI agent (Claude Code), which ran the reproduction and tests quoted above. It has not been separately reviewed by a human.
Reduced test cases
<button type="button" class="btn" data-bs-toggle="tooltip" data-bs-title="9.90">price</button>
<button type="button" class="btn" data-bs-toggle="tooltip" data-bs-title="">empty</button>
<button type="button" class="btn" data-bs-toggle="tooltip" data-bs-title="after">after</button>
<script>
[...document.querySelectorAll('[data-bs-toggle="tooltip"]')].map(el => new bootstrap.Tooltip(el))
</script>
Hover "price": shows 9.9. The second button throws, and "after" never gets a tooltip.
What operating system(s) are you seeing the problem on?
Linux
What browser(s) are you seeing the problem on?
Chrome
What version of Bootstrap are you using?
5.3.8 and main (v6.0.0-alpha.1)
Resolution by version
The v6 fix merged in #43113 for v6.0.0-alpha.2. Decimal strings and empty titles now keep their original text. This issue remains open for the v5 backport.
- Dominant language
- MDX
- Stars
- 175k
- Forks
- 78.7k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 103
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from twbs/bootstrap
-
Select input form caret wrong position on RTL modePossibly taken A pull request linked to this issue is open or already merged. Openbug confirmed css v6
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
twbs/bootstrap#43327 · 1 comment ·
Maintainers usually reply within 1 day
-
v6: OTP input keeps the rest of a selection when you type over itPossibly taken @thejesh23 claimed this 2 days ago. Openbug confirmed has-pr js v6
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
twbs/bootstrap#43323 · 2 comments ·
Maintainers usually reply within 1 day
-
v6: Strength ignores common symbols as special charactersPossibly taken @thejesh23 claimed this 2 days ago. Openbug confirmed docs has-pr js v6
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
twbs/bootstrap#43322 · 1 comment ·
Maintainers usually reply within 1 day
-
v6 alpha - hover-lift effect on menu dropdown only works when mouse is over the buttonPossibly taken @Aryan9891 claimed this 5 days ago. Openbug confirmed css has-pr v6
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
Maintainers usually reply within 1 day
-
Dialog closes when a file input inside it has its picker cancelledPossibly taken @samyferhat claimed this 5 days ago. Openbug confirmed has-pr js v6
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
twbs/bootstrap#43278 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
ietf-tools/datatracker#12027 ·
Maintainers usually reply within 1 day
-
bug SH_K
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
McNamara84/ernie#1540 ·
Maintainers usually reply within 1 day
-
bug needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
nightly-labs/openbot#6451 ·
Maintainers usually reply within 1 day
-
Panic on live viewport resize when unstyled elements exist in display: none subtreePossibly taken @GoCoder7 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
DioxusLabs/blitz#1488 ·
Maintainers usually reply within 1 day