fix(fab): fan out the first fab-flower action when no main-action is set#4560
Open
JamBalaya56562 wants to merge 2 commits into
Open
fix(fab): fan out the first fab-flower action when no main-action is set#4560JamBalaya56562 wants to merge 2 commits into
JamBalaya56562 wants to merge 2 commits into
Conversation
In .fab-flower the center pin used `:nth-child(-n + 2)`, which forced BOTH the trigger and the first action to the center — so without an explicit .fab-main-action / .fab-close, the first action overlapped (and "replaced") the trigger instead of fanning out into the arc. Pin the center by identity (the trigger plus .fab-main-action / .fab-close) and split the arc geometry into two modes: with a main-action/close the arc starts at the 3rd child (unchanged); without one, the first action (2nd child) also fans out, with the per-count degree distribution shifted accordingly (up to 5 actions). Also document the optional-main-action behaviour with a new example. Closes saadeghi#4531 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
JamBalaya56562
added a commit
to JamBalaya56562/daisyui
that referenced
this pull request
Jun 17, 2026
…tion) submitted to v5.6 Add saadeghi#4531 to the implementation-history table with PR saadeghi#4560, the Tailwind Play demo (https://play.tailwindcss.com/16jkNZOdsE) and the headless before/after result (first action overlap d:0 -> 1.4+); annotate its detail subsection as PR-submitted/awaiting merge (was held for the maintainer, who deferred it to v5.6 but had not implemented it); update the remaining-count note; and add saadeghi#4531 to the headless visual-verification track record. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
Hello. I would say that the solution is a little bit convoluted.
|
Owner
|
Thanks for the PR. |
Address review (pdanpdan, saadeghi): instead of wrapping the existing arc blocks in :has(.fab-main-action) / :has(.fab-close), leave them untouched and add the no-main-action geometry as a separate :not(:has(.fab-main-action, .fab-close)) override (existing degrees, shifted by one child, :nth-child(n + 6) hidden). Mode A CSS is now byte-identical to v5.6, so the diff is additive and carries no regression risk. The no-main arc caps at 4 actions to match the with-main capacity; docs capacity note updated. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Thanks @pdanpdan and @saadeghi — updated to keep the change minimal and additive, exactly along the lines you suggested:
So the net diff vs |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4531
Problem
In
.fab-flowerthe center pin was> *:nth-child(-n + 2) { --position: 0rem; }, which pinned both the trigger (1st child) and the first action (2nd child) to the center. So when no.fab-main-action/.fab-closeis present, the first action button overlaps and "replaces" the trigger instead of fanning out into the quarter-circle arc.As reported by @topherfangio, this should only happen when a button is explicitly marked
.fab-main-action. (@saadeghi: "You're right. Will be fixed in v5.6 soon.")Fix (minimal / additive)
Following review (@pdanpdan, @saadeghi) the change is kept as small and additive as possible:
.fab-main-action/.fab-close(> *:nth-child(1), > .fab-main-action, > .fab-close).:has(:nth-child(3..6))) are left untouched — Mode A (with a main-action/close) is byte-identical tov5.6, so there is no regression risk.&:not(:has(.fab-main-action, .fab-close)), mirroring the existing degrees shifted by one child (the arc starts at the 2nd child) and hiding:nth-child(n + 6)so it caps at the same 4 actions as Mode A.Net diff vs
v5.6is just the identity-pin line + the appended:not(:has())block. (An earlier revision wrapped the existing rules in:has(.fab-main-action)/:has(.fab-close); that wrapping has been reverted.)Playground
Rows are action counts, left column is the released (buggy) daisyUI, right column is this PR. Heads-up: Play loads the released daisyUI, so the right column re-creates the fix's result with a clearly-labelled preview shim on top of it — that shim is more verbose than this PR (it has to override the released
@layerrules). The real CSS is the small diff above.Verification
bun run buildsucceeds (lightningcss accepts the:not(:has())selectors) andbun testpasses (86/86).Headless-Chromium measurement of each action's center offset from the trigger (button = 48px), opening each FAB via
:focus-within:fab-main-action/ 3fab-close/ 3dist 0) to fanning out (dist > 0) at the correct angles.fab-main-action/fab-closethe center button stays on the trigger and the arc matches the unchangedv5.6geometry.Notes
packages/daisyui/src/components/fab.css, plus a docs example (fab-flower without a main action) and a capacity note.🤖 Generated with Claude Code