Skip to content

Use real table layout for the calendar grid (fixes missing days on Dioxus Native) - #314

Open
nicoburns wants to merge 1 commit into
mainfrom
fix/calendar-native-table-layout
Open

nicoburns wants to merge 1 commit into
mainfrom
fix/calendar-native-table-layout

Conversation

@nicoburns

Copy link
Copy Markdown
Member

Summary

Fixes the calendar grid rendering as an empty box under Dioxus Native (dx serve -p preview --features native --macos): no weekday header and no day cells.

Root cause: the grid is a <table>, but .dx-calendar-grid-body (tbody), .dx-calendar-grid-header and .dx-calendar-grid-week (tr) were styled display: flex. Browsers tolerate this via CSS 2.1 anonymous table box generation (the flex boxes get wrapped in an anonymous cell), but Blitz has no anonymous table box generation: collect_table_cells in blitz-dom/src/layout/table.rs only collects descendants whose display is a table type and silently ignores Flow | Flex | Grid children, so every row and cell was dropped.

Fix: keep tbody/tr/td at their native table display types and express the old flex layout with table features instead:

  • table-layout: fixed on the table → equal-width columns (was flex: 1)
  • border-collapse: separate; border-spacing: 0 0.25rem → vertical gap between weeks (was flex gap)
  • .dx-calendar-grid-cell becomes display: block; margin: 0 auto → centered 2rem button inside the cell
  • td padding reset to 0; margin-top/bottom on td (which never applies inside a table) removed

Only preview/src/components/calendar/style.css changes; no Rust or markup changes.

Test plan

  • Native (--features native --macos): weekday header and all days render for the default, range and multi-month variants; hover and day selection work; row spacing and out-of-month dimming match the web look
  • npx stylelint passes on the stylesheet
  • Web/Playwright calendar.spec.ts — could not run locally (this machine's clang has no wasm32 target, so the wasm build of arborium-sysroot fails); relying on CI

The calendar grid is a <table>, but its tbody and tr elements were styled
with display: flex. Browsers paper over this by wrapping the flex boxes in
anonymous table cells, but Blitz (Dioxus Native) has no anonymous table
box generation and drops any table descendant whose display is not a table
type, so the weekday header and every day cell disappeared natively.

Keep the table parts at their native display types and reproduce the old
layout with table features instead: table-layout: fixed for equal columns,
border-spacing for the row gap, and an auto-margin block button for
centering. Margins on td (which never applied inside a table) are dropped.

This branch has not been deployed

No deployments
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.

1 participant