Tooltip/popover: data-bs-title and data-bs-content are reformatted or throw ("9.90" shows as "9.9", empty title throws)
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- javascript
- Ambito
- frontend
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- MDX
- Stelle
- 175k
- Fork
- 78.7k
- Merge medio
- 1g 5h
- PR unite (30g)
- 94
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di twbs/bootstrap
-
Disabled radio toggle button groups lose checked stateForse già presa @vladosskins178 l’ha presa oggi. Apertabug confirmed css has-pr v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
css docs feature v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
I maintainer di solito rispondono entro 1 giorno
-
`.visually-hidden` class uses the deprecated `clip` CSS propertyForse già presa @Aryan9891 l’ha presa oggi. Apertaaccessibility css has-pr refactoring v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
twbs/bootstrap#43333 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Select input form caret wrong position on RTL modeForse già presa @adityajai119 l’ha presa 1 giorno fa. Apertabug confirmed css has-pr v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
twbs/bootstrap#43327 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
v6: OTP input keeps the rest of a selection when you type over itForse già presa @thejesh23 l’ha presa 3 giorni fa. Apertabug confirmed has-pr js v6
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
twbs/bootstrap#43323 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di twbs/bootstrap
Issue simili
-
文字サイズ最大で服薬タブの日付の見出しとカレンダータブの月の見出しが切れるForse già presa Una pull request collegata a questa issue è aperta o già unita. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
bannzai/medicalarm#572 ·
I maintainer di solito rispondono entro 1 giorno
-
area:tooling good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
interledger/publisher-tools#1007 ·
I maintainer di solito rispondono entro 1 giorno
-
priority/medium roadmap/v1.1.1 stakeholder/rapr type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
databrickslabs/ontos#1420 ·
I maintainer di solito rispondono entro 3 giorni
-
🐞 bug 🧐 unconfirmed
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
Tencent/tdesign-vue-next#7056 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
eyalgolan/statecraft-israel#3093 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno