Skip to content

fix(ui): fix calendar layout collapse in safari using grid#9612

Open
yanhanruan wants to merge 2 commits intoshadcn-ui:mainfrom
yanhanruan:fix/calendar-safari-layout
Open

fix(ui): fix calendar layout collapse in safari using grid#9612
yanhanruan wants to merge 2 commits intoshadcn-ui:mainfrom
yanhanruan:fix/calendar-safari-layout

Conversation

@yanhanruan
Copy link

Description

This PR fixes a layout issue in Safari (WebKit) where the Calendar component would collapse or behave unexpectedly when set to w-full inside a constrained container.

The issue was caused by Safari's handling of flex layouts within table structures. This fix replaces the flex layout for weeks and weekdays with grid, and adjusts the CalendarDayButton to fully fill the grid cells, ensuring consistent rendering across Chrome, Firefox, and Safari.

Fixes

Closes #9468

Visual Evidence

Browser Before Fix (Bug) After Fix (Grid Layout)
Safari image image
Chrome image image
Firefox image image

Changes

  • Changed table class to block to prevent layout collapse.
  • Updated weekdays and week rows to use grid grid-cols-7.
  • Updated CalendarDayButton to h-full w-full to fix sizing inconsistencies in grid cells.

Replaces flex layout with css grid for calendar weeks and days to ensure consistent width handling in WebKit browsers.
@vercel
Copy link
Contributor

vercel bot commented Feb 11, 2026

@yanhanruan is attempting to deploy a commit to the shadcn-pro Team on Vercel.

A member of the Team first needs to authorize it.

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.

[bug]: w-full on the calendar root works in chrome to make the calendar responsive but breaks the styling for the calendar in safari

1 participant