Skip to content

Feat: Replace Tooltipster with Floating UI. - #183

Open
mgiannopoulos24 wants to merge 13 commits into
XjSv:developfrom
mgiannopoulos24:feat/tooltip-lib
Open

mgiannopoulos24 wants to merge 13 commits into
XjSv:developfrom
mgiannopoulos24:feat/tooltip-lib

Conversation

@mgiannopoulos24

@mgiannopoulos24 mgiannopoulos24 commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

This PR replaces the old and no longer maintained Tooltipster library with Floating UI (@floating-ui/core + @floating-ui/dom 1.8.0), which is lightweight and not jQuery based.

  • Vendored library: the UMD builds live under assets/vendor/floating-ui together with their MIT LICENSE and a README.md describing the version, source and how to update. This allows the migration of all third party libs from assets/js in the future.
  • Tooltips: a small delegated handler in assets/admin/js/cooked-functions.js shows .cooked-tooltip[data-tooltip] elements on hover/focus, closes on Escape, sets aria-describedby and positions them with Floating UI (flip, shift, arrow). data-positions="top" is still supported. It is scoped to .cooked-tooltip so other plugins' data-tooltip attributes are never rendered as HTML.
  • Save as Default: the "Default Recipe Template" panel floats next to its button again, like it did with Tooltipster, but is now real markup (#cooked-save-default-panel) instead of HTML inside a title attribute.
  • Consistency: the Recipe Excerpt, SEO Description and Recipe Notes tooltips now have the same green heading as Recipe Template (reusing existing translated strings).
  • Styling: matches the old tooltips, plus minor fixes on gulpfile.js.
  • Admin enqueues: cooked-admin-functions depends on the Floating UI handles, so load order is guaranteed (also with script optimization plugins).
  • Shared helper: positioning lives in the global cooked_position_floating() (with the .cooked-tooltip-arrow styles). Cooked Pro uses it for its Auto Nutrition popover, so keep its name and signature stable.
  • Fallback: if Floating UI fails to load (blocked, 404), tooltips are skipped and the panel opens inline. The rest of the admin JS keeps working.

Related issue

Closes #182

Checklist

Please check if your PR fulfills the following requirements:

  • Tested in latest version of WordPress
  • No JavaScript errors or warnings in the console
  • No PHP errors or warnings logs
  • Generate language files, if necessary
  • Extended the README / documentation / etc, if necessary

🤖 Generated with Claude Code

@mgiannopoulos24 mgiannopoulos24 changed the title Feat: Change Tooltipster with tooltip lib. Feat: Replace Tooltipster with tooltip lib. Sep 20, 2026
@XjSv XjSv self-assigned this Sep 21, 2026
@XjSv XjSv added enhancement New feature or request dependencies Pull requests that update a dependency file javascript Pull requests that update Javascript code labels Sep 21, 2026
@XjSv XjSv added this to the 1.17.0 milestone Sep 21, 2026
XjSv and others added 5 commits September 27, 2026 15:01
The trigger was only ever disabled when the recipe had no named
ingredient, but `.cooked-auto-nutrition-button` is a Cooked Pro element
and the trigger used to be a <span>, so `prop('disabled')` had no
effect and the button was always clickable.

Cooked Pro now renders a real <button> there, which made the dormant
call live and left a dead button with no explanation. Drop the logic
here so both plugins agree, and let the panel surface the error
instead.
Vendor @floating-ui/core and @floating-ui/dom 1.8.0 (UMD) with their MIT
license under assets/vendor/floating-ui and drop assets/vendor/tooltip.

Tooltips are now a small delegated handler on .cooked-tooltip[data-tooltip]
positioned with Floating UI (flip, shift, arrow). The Save as Default panel
floats next to its button again, like it did with Tooltipster. All recipe
setting tooltips get the green heading for consistency.

If Floating UI fails to load, tooltips are skipped and the panel opens
inline, so the rest of the admin JS keeps working.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mgiannopoulos24 mgiannopoulos24 changed the title Feat: Replace Tooltipster with tooltip lib. Feat: Replace Tooltipster with Floating UI. Oct 4, 2026
XjSv and others added 6 commits October 5, 2026 18:16
Bring back Tooltipster's grow: Floating UI positions an outer shell and
only the inner .cooked-tooltip-bubble scales (400ms, eased, with a fade),
so flip, shift and the arrow still measure the full box. The arrow sits
inside the bubble and scales with it.

Hover tooltips open after 100ms (leaving sooner shows nothing), focus
opens at once, and leaving or Escape grows them closed before hiding.
Save as Default grows the same way with no delay when Floating UI places
it; without Floating UI it stays an instant inline panel.

cooked_grow_open(), cooked_grow_close() and cooked_grow_cancel() are
global so Cooked Pro can reuse them.

Headings no longer wrap; min-width lets a long heading widen the 275px
bubble instead of overflowing it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file enhancement New feature or request javascript Pull requests that update Javascript code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants