Skip to content

Use proper bootstrap tooltip functions#3183

Merged
Crabcyborg merged 1 commit into
masterfrom
use_proper_bootstrap_tooltip_functions
Jul 8, 2026
Merged

Use proper bootstrap tooltip functions#3183
Crabcyborg merged 1 commit into
masterfrom
use_proper_bootstrap_tooltip_functions

Conversation

@Crabcyborg

@Crabcyborg Crabcyborg commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • Bug Fixes
    • Updated tooltip behavior in the admin builder to work with the newer Bootstrap tooltip system.
    • Tooltips now display more reliably when hovering or opening items, with improved handling of repeated tooltip interactions.

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Tooltip initialization in the admin builder's JavaScript was migrated from jQuery-based tooltip calls to Bootstrap 5's Tooltip API. Both loadTooltip and addTooltip functions now create and manage bootstrap.Tooltip instances instead of using jQuery methods.

Changes

Tooltip Migration

Layer / File(s) Summary
Bootstrap Tooltip initialization and lazy caching
js/src/admin/admin.js
loadTooltip now creates a bootstrap.Tooltip instance, calls deleteTooltips(), and shows it via the Bootstrap API; addTooltip's mouseover handler lazily creates and caches a bootstrap.Tooltip instance on the element instead of using jQuery tooltip initialization.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change: switching admin tooltips to the proper Bootstrap tooltip API.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch use_proper_bootstrap_tooltip_functions

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@deepsource-io

deepsource-io Bot commented Jul 8, 2026

Copy link
Copy Markdown

DeepSource Code Review

We reviewed changes in 47504f9...6e4b73e on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

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.

@Crabcyborg
Crabcyborg merged commit 6957fcd into master Jul 8, 2026
44 of 48 checks passed
@Crabcyborg
Crabcyborg deleted the use_proper_bootstrap_tooltip_functions branch July 8, 2026 17:05

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 win

Show the tooltip on first hover in addTooltip()
Creating the bootstrap.Tooltip inside the mouseover handler is too late for that same hover, so the first hover never shows anything. Call show() after instantiating it, like loadTooltip() 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 win

Reuse the Bootstrap tooltip instance and show it on first hover.

  • js/src/admin/admin.js:551-556: loadTooltip() creates a new bootstrap.Tooltip on every delegated hover, and deleteTooltips() 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 calls show(), 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

📥 Commits

Reviewing files that changed from the base of the PR and between 47504f9 and 6e4b73e.

📒 Files selected for processing (2)
  • js/formidable_admin.js
  • js/src/admin/admin.js

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant