fix(separator): replace self-stretch with h-full for vertical alignment#11036
Open
sergioperezcheco wants to merge 1 commit into
Open
fix(separator): replace self-stretch with h-full for vertical alignment#11036sergioperezcheco wants to merge 1 commit into
sergioperezcheco wants to merge 1 commit into
Conversation
Contributor
|
@sergioperezcheco is attempting to deploy a commit to the shadcn-pro Team on Vercel. A member of the Team first needs to authorize it. |
3ceeb31 to
0b142e3
Compare
The vertical Separator's data-vertical:self-stretch class set align-self: stretch, which overrides the parent flex container's items-center alignment. This caused the separator to stick to the top of the row instead of being vertically centered — visible in sidebar headers, breadcrumbs, toolbars, and anywhere a fixed-height vertical separator sits in an items-center flex row. The new-york-v4 style already uses data-vertical:h-full (which does not override align-self), so this change aligns the Base UI and Radix separators with that behavior. Affected files: - apps/v4/registry/bases/base/ui/separator.tsx - apps/v4/registry/bases/radix/ui/separator.tsx Closes shadcn-ui#11027
0b142e3 to
02474b1
Compare
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.
Summary
The vertical
Separatorin Base UI and Radix styles usesdata-vertical:self-stretch, which setsalign-self: stretch. This overrides the parent flex container'sitems-centeralignment, causing the separator to stick to the top of the row instead of being vertically centered.This is visible in sidebar headers, breadcrumbs, toolbars, and anywhere a fixed-height vertical separator sits in an
items-centerflex row — exactly the pattern used throughout the docs/blocks examples (e.g.data-[orientation=vertical]:h-4).Root Cause
align-self: stretchon a flex child that already has a fixed height (e.g.h-4) causes the child to align toflex-start(top) instead of being centered by the parent'sitems-center.The
new-york-v4style already usesdata-vertical:h-fullinstead ofself-stretchand does not have this problem.Fix
Replace
data-vertical:self-stretchwithdata-vertical:h-fullin both Base UI and Radix separator components, matching the workingnew-york-v4implementation:bases/base/ui/separator.tsxdata-vertical:self-stretch→data-vertical:h-fullbases/radix/ui/separator.tsxdata-vertical:self-stretch→data-vertical:h-fullThe
button-group.tsxfiles also useself-stretchbut in a different context (cn-button-group-separatorwith explicitdata-vertical:h-auto), so they are intentionally left unchanged.Verification
Confirmed by the issue reporter: removing
self-stretchsoalign-selffalls back toautorecenters the separator perfectly. Theh-fullapproach is already proven innew-york-v4.Closes #11027