Skip to content

Fix tooltips collapsing full-width triggers - #2874

Draft
ganyicz wants to merge 1 commit into
mainfrom
filip/tooltip-display-contents
Draft

ganyicz wants to merge 1 commit into
mainfrom
filip/tooltip-display-contents

Conversation

@ganyicz

@ganyicz ganyicz commented Oct 29, 2026

Copy link
Copy Markdown
Collaborator

Requires livewire/flux-pro#607. Merge and release that first. Without it, hovering a disabled button or toggle no longer shows its tooltip.

The scenario

Wrapping a progress bar in a tooltip makes the bar disappear. Inputs, selects, cards and w-full buttons with a tooltip prop shrink to their content.

<flux:tooltip content="60 / 100">
    <flux:progress value="60" />
</flux:tooltip>

<flux:button tooltip="Save changes" class="w-full">Save</flux:button>

Progress inside a tooltip before

Input, select and card inside tooltips before

Full-width button with a tooltip before

The problem

Since #2746, ui-tooltip is display: inline-flex, so it shrinks to fit its content, and a full-width child sizes itself from that shrunken width.

  1. The tooltip asks its child how wide it wants to be.
  2. flux:progress is w-full and has no content, so it answers "0".
  3. The tooltip becomes 0px wide, and the progress bar fills 100% of 0px.

Components with content, like inputs, selects and cards, don't disappear. They shrink to their content instead. with-tooltip adds the same inline-flex (#2743), so <flux:button tooltip="…" class="w-full"> doesn't fill its row.

That box was only added so disabled triggers have something under the pointer. A disabled button has pointer-events: none, so the pointer falls through it to the tooltip.

The solution

ui-tooltip doesn't render a box anymore, so its children lay out as if it weren't there:

ui-tooltip { display: contents; }

with-tooltip no longer adds inline-flex.

The JS side (livewire/flux-pro#607) no longer needs that box:

  • It finds the real trigger by skipping wrappers without a box.
  • It detects hovers over disabled triggers by checking the pointer against the trigger's own box.

This also fixes <flux:tooltip><flux:toggle /></flux:tooltip>, whose tooltip was positioned at the top-left of the page and whose aria-describedby landed on the <flux:accent> wrapper:

Toggle tooltip position before

Flux's own usages:

  • flux:avatar.group overlaps avatars with *:not-first:-ml-2. A margin on the tooltip has no effect anymore, so the avatar inside a tooltip gets it instead.
  • flux:sidebar.search put w-full on its tooltip. That no longer does anything, and the button inside is already w-full, so it's removed.
  • flux:sidebar.item keeps class="block" on its tooltip, so it's unchanged.
  • The editor toolbar already used class="contents", so it's unchanged.

I compared the sidebar (expanded and collapsed), button groups, input groups, avatars, toggles, the editor toolbar and calendars before and after. They matched, with one exception. An icon button with a tooltip inside flux:input.group now shrinks a few pixels like the same button without a tooltip does (40px → ~36px in a 320px group). Before this change, the tooltip's box stopped it from shrinking.

Breaking change

Classes on <flux:tooltip> that rely on it having a box no longer apply unless you also add a display class. Examples are margins, padding, w-full, flex-1 and positioning. Display classes like class="block" still give it a box and work as before.

Fixes #2849

@ghabriel25

ghabriel25 commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

@ganyicz I wonder if we could just support tooltip for progress component and use the same fix #2804 did instead another bc

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.

Flux progress wrapped inside flux:tooltip not showing the progress bar

2 participants