Skip to content

fix(tooltip): don't open an empty bubble when content is missing (Solid 2) - #153

Merged
riccardoperra merged 1 commit into
feat/upgrade-solid2-kobaltefrom
fix/tooltip-empty-content-solid2
Nov 28, 2026
Merged

riccardoperra merged 1 commit into
feat/upgrade-solid2-kobaltefrom
fix/tooltip-empty-content-solid2

Conversation

@riccardoperra

Copy link
Copy Markdown
Owner

Ports #152 (merged to main as 05d9889) to feat/upgrade-solid2-kobalte.

What

When Tooltip's content is undefined, null, false or "", the tooltip stays closed on hover and on focus, and no empty bubble appears. The trigger, its children and slotClasses.trigger render as before. The trigger never gets an aria-describedby that points at nothing.

The fix is the same as on main. Tooltip passes disabled to the root when the content is empty, and it skips the portal and content. Kobalte 2.0.0-alpha.5's TooltipRoot checks isDisabled() in both its pointer path and its focus path, so disabled stops both.

Porting notes

  • The only conflict was in Tooltip.tsx. I re-applied the behaviour in this branch's Solid 2 style (omit and props.* instead of splitProps/local) rather than copying the file. feat(kit): calmer tooltip defaults and TooltipProvider #149's Root defaults and TooltipProvider in parts/tooltip.tsx are unchanged.
  • The test, story, changeset, API report line, feature map and journey applied cleanly.
  • I changed one thing in the journey. tooltip-empty.mjs waited 600 ms after hover or focus. Since feat(kit): calmer tooltip defaults and TooltipProvider #149, the default openDelay on this branch is 700 ms, so a 600 ms wait would pass even if a bubble were about to open. It now waits 1000 ms.

Verification

  • vitest --project browser: 680/680 passing. This includes the 3 new empty-content cases and tooltip-provider.test.tsx, which covers the provider and the shared-delay behaviour from feat(kit): calmer tooltip defaults and TooltipProvider #149. One cold-start run had 4 unrelated failures (keyboard/listbox); the next two runs passed in full.
  • test:ssr 34/34, test:hydration 2 + 41 passing.
  • typecheck passes. pnpm api:check reports "Public API matches the committed report".
  • verify-codeui (static Storybook, dark and light), all checks pass:
    • designsystem-tooltip--empty-content + tooltip-empty.mjs: hovering and Tab-focusing Undefined, Null and Empty string shows no bubble and adds no aria-describedby. "With content" still opens on focus and on hover, and describes the button.
    • designsystem-tooltip--tooltip-story + tooltip-keyboard.mjs and tooltip-motion.mjs: no regression in focus/Escape, motion or description placement.
    • designsystem-tooltip--tooltip-disabled: renders.
    • Axe reports only the expected Storybook landmark-one-main and page-has-heading-one.
  • Not proved in the browser: motion, because the harness turns animations off. There is no Storybook story for TooltipProvider; the unit tests cover it.

🤖 Generated with Claude Code

Port of #152 (05d9889) to the Solid 2 / Kobalte 2 branch.

When `content` is `undefined`, `null`, `false` or `""`, Tooltip now passes
`disabled` to the Kobalte root and skips the portal. Hover and focus leave
it closed, and Kobalte only sets `aria-describedby` while open, so the
trigger never points at a missing bubble. The trigger, its children and
`slotClasses.trigger` render unchanged.

The conflict in Tooltip.tsx was resolved for Solid 2 (`omit` instead of
`splitProps`, reading `props.*`). The verify-codeui journey waits 1 s after
hover and focus, since this branch's default `openDelay` is 700 ms.

Adds an "Empty content" story, a verify-codeui journey and unit tests.

(cherry picked from commit 05d9889)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 28, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f225914

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@codeui/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions

Copy link
Copy Markdown
Contributor

CodeUI package preview

Built from f225914.

npm install https://pkg.pr.new/riccardoperra/codeui/@codeui/kit@f225914b615737675a26cc8cc83ac9513c50f63e

The kit installs matching previews of @codeui/styles and @codeui/inkstone.

@riccardoperra
riccardoperra merged commit 57722e1 into feat/upgrade-solid2-kobalte Nov 28, 2026
5 of 6 checks passed
@riccardoperra
riccardoperra deleted the fix/tooltip-empty-content-solid2 branch November 28, 2026 15:44
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview deployed to Cloudflare Pages.

Built from f225914.

This branch was successfully deployed

1 active deployment
docs-preview — f225914b Deployed Nov 28, 2026 by riccardoperra via Deploy to Cloudflare Pages #168
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant