Use proper bootstrap tooltip functions#3183
Conversation
📝 WalkthroughWalkthroughTooltip initialization in the admin builder's JavaScript was migrated from jQuery-based tooltip calls to Bootstrap 5's Tooltip API. Both ChangesTooltip Migration
Estimated code review effort: 1 (Trivial) | ~5 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| PHP | Jul 8, 2026 5:01p.m. | Review ↗ | |
| JavaScript | Jul 8, 2026 5:01p.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
js/src/admin/admin.js (2)
1591-1603: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick winShow the tooltip on first hover in
addTooltip()
Creating thebootstrap.Tooltipinside themouseoverhandler is too late for that same hover, so the first hover never shows anything. Callshow()after instantiating it, likeloadTooltip()does.🔧 Suggested fix
function() { if ( ! element.__bootstrapTooltip ) { element.__bootstrapTooltip = new bootstrap.Tooltip( element ); + element.__bootstrapTooltip.show(); } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@js/src/admin/admin.js` around lines 1591 - 1603, The first hover in addTooltip() does not display the tooltip because bootstrap.Tooltip is only instantiated inside the mouseover handler and never shown for that same event. Update addTooltip() so that when __bootstrapTooltip is created it immediately calls show(), matching the behavior used in loadTooltip(), while keeping the existing tooltip initialization and reuse logic intact.
539-557: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winReuse the Bootstrap tooltip instance and show it on first hover.
js/src/admin/admin.js:551-556:loadTooltip()creates a newbootstrap.Tooltipon every delegated hover, anddeleteTooltips()only removes the popup DOM. Reuse the existing instance or dispose it before re-creating.js/src/admin/admin.js:1598-1601:addTooltip()creates the tooltip lazily but never callsshow(), so the first mouseover does nothing.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@js/src/admin/admin.js` around lines 539 - 557, `loadTooltip()` is creating a fresh Bootstrap tooltip instance on every hover, while `deleteTooltips()` only clears the popup DOM, so update the tooltip lifecycle to reuse an existing `bootstrap.Tooltip` on `tooltipTarget` or dispose the prior instance before re-creating it. Also update `addTooltip()` so the lazy-created tooltip is actually shown on the first hover by calling `show()` after initialization, using the existing `loadTooltip()`/`deleteTooltips()` flow and the tooltip target handling already present in `admin.js`.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@js/src/admin/admin.js`:
- Around line 1591-1603: The first hover in addTooltip() does not display the
tooltip because bootstrap.Tooltip is only instantiated inside the mouseover
handler and never shown for that same event. Update addTooltip() so that when
__bootstrapTooltip is created it immediately calls show(), matching the behavior
used in loadTooltip(), while keeping the existing tooltip initialization and
reuse logic intact.
- Around line 539-557: `loadTooltip()` is creating a fresh Bootstrap tooltip
instance on every hover, while `deleteTooltips()` only clears the popup DOM, so
update the tooltip lifecycle to reuse an existing `bootstrap.Tooltip` on
`tooltipTarget` or dispose the prior instance before re-creating it. Also update
`addTooltip()` so the lazy-created tooltip is actually shown on the first hover
by calling `show()` after initialization, using the existing
`loadTooltip()`/`deleteTooltips()` flow and the tooltip target handling already
present in `admin.js`.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: c73c28a0-b066-4d5c-9bac-3b9c8c18e167
📒 Files selected for processing (2)
js/formidable_admin.jsjs/src/admin/admin.js
Summary by CodeRabbit