Skip to content

Apply attributes to the root element of text separators - #2675

Merged
calebporzio merged 1 commit into
mainfrom
separator-root-attributes
Aug 14, 2026
Merged

Apply attributes to the root element of text separators#2675
calebporzio merged 1 commit into
mainfrom
separator-root-attributes

Conversation

@calebporzio

Copy link
Copy Markdown
Contributor

Fixes #2555

When a separator has text, the attribute bag was forwarded to the two inner line <div>s instead of the component's root element. So wire:transition landed on the lines — each line got its own view-transition snapshot and faded, while the container and the text span rode along with the root (whose fade Livewire intentionally disables) and popped in instantly.

This applies the attribute bag to the root container instead, and leaves the line divs as internal decoration. Now the whole separator — lines and text — animates as one group:

<flux:separator text="or" wire:transition />

renders as:

<div data-orientation="horizontal" role="none" class="flex items-center w-full" wire:transition data-flux-separator>
    <div class="... h-px w-full grow"></div>
    <span class="...">or</span>
    <div class="... h-px w-full grow"></div>
</div>

This also puts id, data-*, and other passthrough attributes where you'd expect them. Note the one behavior change: custom classes on a text separator now merge onto the root container rather than the two line divs — consistent with how every other component applies its attribute bag to the root element (the plain and vertical variants are untouched).

Verified in a real Livewire v4 app with Playwright: before, mid-transition the buttons and lines were half-faded while the "or" text was at full opacity; after, the separator (text included) receives the view-transition-name and fades with everything else.

🤖 Generated with Claude Code

When a separator has text, the attribute bag was forwarded to the two
inner line divs instead of the component's root element. Directives
like wire:transition ended up on the lines, so the lines animated but
the text (and the element itself) did not.

Apply the attribute bag to the root container instead, and leave the
line divs as internal decoration.

Fixes #2555

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@calebporzio
calebporzio merged commit deb5c32 into main Aug 14, 2026
@calebporzio
calebporzio deleted the separator-root-attributes branch August 14, 2026 11:42
@dfa-yn

dfa-yn commented Aug 14, 2026

Copy link
Copy Markdown

Thanks 👍🏻

@ghabriel25

Copy link
Copy Markdown
Contributor

Hi @calebporzio @joshhanley — I think this may have been missed from the release. Was that intentional?

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.

Text inside flux:separator not animated using wire:transition

3 participants