Skip to content

feat(tooltip): add collision-aware popover mode - #37

Merged
mhenrixon merged 3 commits into
zoolutions:mainfrom
yshmarov:feat/tooltip-popover
Aug 30, 2026
Merged

mhenrixon merged 3 commits into
zoolutions:mainfrom
yshmarov:feat/tooltip-popover

Conversation

@yshmarov

@yshmarov yshmarov commented Aug 29, 2026

Copy link
Copy Markdown

Hey amigo! 👋

Summary

  • add an opt-in Tooltip(:popover) mode that renders real tooltip content in the browser top layer
  • open on hover or focus and keep the tooltip inside the visual viewport with flip-and-shift positioning
  • render one borderless arrow that follows the trigger after collision adjustment
  • preserve classic data-tip rendering and add ARIA wiring, rich content support, documentation, and browser coverage

Usage

Tooltip(:popover, tip: "Helpful details") do
  Button(:circle) { "?" }
end

Register the bundled controller with lazyLoadControllersFrom("daisy_ui/controllers", application).

Validation

  • gem RSpec: 1,369 examples, 0 failures
  • gem RuboCop: 159 files, 0 offenses
  • docs RSpec: 9 examples, 0 failures
  • focused docs RuboCop: 0 offenses
  • Biome check: clean
  • Tailwind CSS build: clean

Summary by cubic

Adds an opt-in Tooltip(:popover) mode that renders real tooltip content in the browser top layer, avoiding clipping ancestors, and flips/shifts it to stay inside the visual viewport. Classic data-tip rendering is unchanged.

  • Opens on hover or focus, closes on leave, blur, or Escape.
  • Uses role="tooltip" and wires aria-describedby to the first interactive trigger.
  • Positions with one borderless arrow that follows the trigger after collision adjustment.
  • Preserves caller-supplied Stimulus controllers; stimulus: overrides the controller identifier and popover_id: sets a stable id.
  • Rich content renders via the content sub-component, falling back to the tip string.
  • Bundled daisy-tooltip Stimulus controller is auto-pinned for importmap-rails apps.

Migration

  • Bundler users must import daisy_tooltip_controller.js and register it as daisy-tooltip.

Written for commit 292ff6b. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 9 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread app/javascript/daisy_ui/controllers/daisy_tooltip_controller.js Outdated
Comment thread lib/daisy_ui/tooltip.rb Outdated
Comment thread lib/daisy_ui/tooltip.rb
Comment thread docs/spec/system/tooltip_popover_spec.rb

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

All reported issues were addressed across 5 files (changes from recent commits).

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread app/javascript/daisy_ui/controllers/daisy_tooltip_controller.js Outdated

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

0 issues found across 2 files (changes from recent commits).

Re-trigger cubic

@mhenrixon
mhenrixon merged commit 46beadf into zoolutions:main Aug 30, 2026
8 checks passed
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.

2 participants