Skip to content

feat(components): layout blocks open on their default tab, keep every item and link, and card grids stop reflowing - #317

Open
sydevs-bot wants to merge 8 commits into
claude/fix-popover-roles-and-accordionfrom
claude/feat-layout-block-parity
Open

sydevs-bot wants to merge 8 commits into
claude/fix-popover-roles-and-accordionfrom
claude/feat-layout-block-parity

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #302; GitHub retargets this PR to main when that one merges.

Summary

  • Visitors. Card grids (content indexes such as /inspiration) are now laid out in CSS alone. On a phone the server's first paint no longer draws three thin columns that collapse to one after hydration: CLS at 390px goes from 0.0485 to 0. Where the browser supports native masonry (display: grid-lanes) the cards pack into the shortest column. Elsewhere they sit in plain grid rows.
  • The layout block now renders what editors entered.
    • The grid style shows the first three items and a "Show More" button, as the old site did (/shri-mataji).
    • Tabs open on the editor's default tab: /mooladhara-chakra opens on "Center aspect" on a phone.
    • Tabs past five are no longer dropped.
    • Accordion items keep their image and link.
    • Bare-slug title links such as techniques now go to /techniques instead of rendering as dead <a> tags.
  • Without JavaScript, every grid item shows and the Show More button is hidden. Nothing stays behind a button that cannot run.
  • Developers. react-masonry-css is gone. A masonry @utility in layouts/tailwind.css is the only masonry implementation, and ContentGrid and MasonryGrid both use it.

Preview

  • /shri-mataji — the layout block's grid style: 3 of 11 entries and a Show More button, which reveals the other 8 and moves focus to the first one.
  • /mooladhara-chakra — at phone width the tabs open on "Center aspect", the editor's default, and tab titles are plain text rather than dead # links.
  • /inspiration — the card grid laid out in CSS: at 390px one column from the first paint, with no reflow after hydration.
  • /try-our-guided-course-to-explore-deeper-concepts — bare-slug title links such as techniques now go to /techniques.
  • Ladle: Masonry grid, Layout block and Column carousel — the reworked grid items, and the new six-column carousel section.

What changed and why

  • F14b, card grids in CSS (layouts/tailwind.css @utility masonry; components/molecules/ContentGrid/ContentGrid.tsx)
    • The utility uses display: grid with 1 column, 2 at sm (640px) and 3 at lg (1024px). These are the old bands. align-items: start is set, and @supports (display: grid-lanes) { display: grid-lanes } turns on lane packing.
    • fit-tolerance is left at its normal (1em) default. The 2026 drafts renamed it from flow-tolerance, which is the name Safari 26.4 shipped. Leaving it unset avoids naming a property that is still moving.
    • Cards stay in DOM order, so reading and tab order follow the editor's order. There is no JavaScript layout and nothing shifts. ContentGrid keeps its props API, its ref and the w-full root that ContentIndex animates. Only breakpointCols is dropped; no caller set it.
    • gap-y-8 replaces the per-card mb-8. A new pb-8 keeps the 32px that margin used to leave under the last row.
    • Measured on /inspiration at 390px:
      • Before (deployed main): 3 server columns of 103px, then 1 column of 342px after hydration. CLS 0.0485.
      • After (local dev against production SahajCloud): identical before and after hydration. CLS 0.
      • At 1280px: 3 columns of 357px, which matches the sizes arithmetic ((1120−48)/3). CLS 0.0005.
    • The built CSS keeps @supports (display:grid-lanes){.masonry{display:grid-lanes}}.
    • Tests: ContentGrid.test.tsx "ContentGrid layout" (order, no inline styles, space under the last row) and layouts/tailwind.test.ts "masonry".
  • Dependency. react-masonry-css was removed with pnpm remove. After pnpm build, grep -rl react-masonry-css dist finds nothing.
  • MasonryGrid rework (components/molecules/MasonryGrid/MasonryGrid.tsx)
    • Each item takes an optional image, title, title link and text. Text keeps its line breaks.
    • headingLevel is 'h2' | 'h3', and a linked title sits inside its heading.
    • All items are in the server HTML. Items past initialItemCount carry hidden, so they are out of the accessibility tree and the tab order. The count is 3, marked shortcut: because SahajCloud has no count field.
    • "Show More" (common.general.show_more) reveals the rest at once, as the legacy .js-loadmore did. Focus then moves to the first revealed <li> (tabIndex -1, focus-ring), because the button unmounts. By keyboard, :focus-visible is true and the ring draws.
    • The count is the button's description, not its name, which keeps WCAG 2.5.3 Label in Name (fix(column-carousel): a dot's 44px hit area is stolen by its neighbour #201). It points at common.a11y.show_more_items, an existing key. The describing span is hidden, so browse mode does not read the count a second time.
    • The hidden items are in the server HTML, so crawlers get them and the first render matches hydration.
    • Tests: MasonryGrid.test.tsx (SSR) and MasonryGrid.interaction.test.tsx (jsdom: focus move, name and description, axe clean).
  • No-JavaScript path for MasonryGrid (review fix; layouts/tailwind.css @layer base)
    • Rule: @media (scripting: none) { [data-masonry-grid] > li[hidden] { display:block !important } [data-masonry-show-more] { display:none } }.
    • It must sit in base: preflight's [hidden] is an !important in that layer, and no later layer can override it.
    • Checked in Chrome on the built stylesheet. With JavaScript off, 11 of 11 items show and there is no button. With JavaScript on, 3 items show and the button is present.
    • Tests: tailwind.test.ts "shows every hidden MasonryGrid item and drops its button with scripting off", and MasonryGrid.test.tsx "marks the grid and its button for the no-script stylesheet".
  • Layout grid style uses MasonryGrid (components/molecules/blocks/LayoutBlock/LayoutBlock.tsx)
    • Grid items pass LayoutBlock's computed heading level. list stays on LayoutCard, and an unknown style still falls through to grid.
    • Live: /shri-mataji shows 3 of 11 entries plus Show More (11 <li>, 8 hidden), as the legacy page does. The home page's 3 linked items show in full, with no button.
    • Visible change: the home grid's item titles take MasonryGrid's legacy-derived look: text-xl font-medium tracking-wide text-gray-700, where it was text-lg semibold gray-800. Legacy is 22px, weight 500, #7b7b7b.
    • Test: LayoutBlock.test.tsx "LayoutBlock grid".
  • defaultTab
    • The converter passes defaultTab. LayoutBlock matches it against each tab's upstream-computed titleUrl anchor, which is the same slugify(strict, lower) upstream applies to both. It does not use our lib/slugify, which differs from upstream and is changing in fix(components): text boxes keep paragraph breaks and non-Latin headings get ToC anchors #304.
    • ColumnCarousel takes startIndex and falls back to the middle column.
    • /mooladhara-chakra (#center-aspect) now opens on "Center aspect" at 390px. The deployed site opens on "Left Aspect".
    • Tests: LayoutBlock.test.tsx (default and fallback), blockConverters.test.tsx "layout block converter", ColumnCarousel.test.tsx "ColumnCarousel start".
  • Tab titles no longer link to #slug. Upstream computes that value as the tab's anchor, but no element has that id. Every tab title was a dead in-page link: the deployed /mooladhara-chakra has 6. Visible change: tab titles are plain text. Test: "does not link a title to its own anchor".
  • Bare-slug title links
    • New editorLinkHref at the end of lib/urls.ts. It reads a value made only of letters, digits, -, _ and / as a site path (techniques becomes /techniques). Anything else passes through unchanged to the Link gate, so javascript:, hosts, #anchor and '' are never respelled.
    • It is used for list, grid and accordion links. The 3 links on /try-our-guided-course-to-explore-deeper-concepts now have hrefs.
    • Tests: lib/urls.test.ts "editorLinkHref", and LayoutBlock.test.tsx "reads a bare slug as a site path".
  • Tabs past five
    • The ColumnCarousel cap goes from 5 to 12, SahajCloud's maxRows. From 6 columns the carousel draws at every width, because 6+ columns do not fit the desktop row. 1–5 columns are unchanged.
    • The Ladle story now documents this, and a new six-column section shows the desktop carousel.
    • Tests: ColumnCarousel.test.tsx "keeps every column past five, in a carousel at every width", and LayoutBlock.test.tsx "keeps every tab, past five".
  • Accordion image and link
    • Items keep their image (Image atom, video ratio).
    • The title link goes at the foot of the panel, with the item title as its text, because the title is the toggle button and cannot hold a link. No new string is added.
    • Test: "keeps an item's image and title link, inside its panel".
  • useColumnsOnDesktop: decided not to read it
    • The upstream admin text is "Display tabs as side-by-side columns on desktop screens", with default false and no import mapping. All 18 live blocks store false, including the 11 that are not tabs. So false is the untouched import default, not an editor's choice.
    • The legacy chakra pages (wemeditate.com/subtle-system/heart-chakra, /mooladhara-chakra) draw these blocks as columns on desktop.
    • Honouring the field would turn all 7 chakra pages into single panels on desktop. The dead prop is removed from LayoutBlock, and a one-line shortcut: in the converter names when to honour it.
    • The 7 live tabs blocks look the same on desktop.
  • No tab UI: decided against
    • The legacy JS configures slick columns: {slidesToShow:3, responsive:[{breakpoint:920, settings:{slidesToShow:1, initialSlide:1, dots:true, arrows:true}}]}. That is columns on desktop and a one-at-a-time carousel on mobile, which ColumnCarousel already reproduces.
    • The old site never had a tab UI, so the APG tabs pattern does not apply.

Not in this PR

  • Sticky block title. pageBuilderGaps lists the block title's upstream "sticky header" behaviour. Both live uses repeat an editor heading right above them, which is an editorial fix, and a sticky title needs a design that works under the sticky site header.
  • Tab anchor ids (deep links such as /page#left-aspect). ColumnCarousel renders every column twice (carousel and flex row, one hidden by CSS), so ids would be duplicated. This needs ColumnCarousel to render each column once.
  • Dead destinations. /lectures, /subtle-system, /app, /live and /classes return 404 on the deployed new site. The newly working links and the home grid point at them. These are content or redirect gaps (feat(server): legacy redirect map and lookup for the wemeditate.com cutover #276).
  • Safari check. Only Chromium was available. Lane packing was checked with --enable-experimental-web-platform-features: computed display: grid-lanes, and items fill the shortest lane. It was not tested in Safari 26.4+.
  • Bundle-size delta from dropping react-masonry-css: not measured. Only its absence from dist/ was checked.
  • Translation keys: none needed. If the owner wants "Read more" wording on the accordion link instead of the item title, a generic key would be needed upstream: blocks.general.read_more, "Read more".
  • Upstream follow-up: default useColumnsOnDesktop to true and backfill the 7 tabs blocks, or drop the field.

Reconciled with open PRs

Test results

Gate: .claude/skills/pr-prep/check.sh, run on the rebased head after the review fixes.

  • Lint: 0 errors. 1008 warnings repo-wide, none on a line this branch adds or changes. I checked this with a per-line intersection of the eslint output and the diff.
  • tsc: passes.
  • vitest: 139 files, 1326 of 1326 tests pass. This includes the axe page-type gate, whose fixtures carry grid and accordion layout blocks.
  • pnpm build: passes. The built CSS keeps the @supports (display:grid-lanes) block and the @media (scripting:none) rule inside @layer base.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw

…them

react-masonry-css chose its column count in JavaScript. The server cannot
know the viewport, so it rendered three columns everywhere and recounted
them in componentDidMount: on a phone /inspiration painted three 103px
slivers and then jumped to one column (CLS 0.0485 measured on the deployed
Worker). It also dealt cards out to columns, so the DOM order, which a
screen reader and the tab key follow, ran down the first column before the
second.

A new `masonry` utility in layouts/tailwind.css does it with CSS: one, two
and three columns at `sm` and `lg` (the same 640px and 1024px bands the
library used), each item packed into the shortest lane through
`display: grid-lanes` inside `@supports`, and plain grid rows where a
browser has no Grid Level 3. The built stylesheet keeps the `@supports`
block. ContentGrid keeps its props, ref and `w-full` root; only
`breakpointCols`, which no caller passed and which was the library's own
setting, goes.

The content-index `sizes` comment now argues from the grid's arithmetic,
which gives the same 357px column.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The layout block's `titleUrl` is free text, and editors type `techniques`
as readily as `/techniques`: three of the six live values are bare, on the
list block of /try-our-guided-course-to-explore-deeper-concepts. With no
scheme and no leading slash, `isSafeLinkHref` rightly refuses them, so
`Link` drew three link-styled anchors with no href.

`editorLinkHref` gives a value made only of letters, digits, `-`, `_` and
slashes its leading slash, and hands every other spelling back unchanged
for the link gate to judge, so a dotted host, a scheme or an anchor is
never respelled into a path. It lives in lib/urls.ts because spelling a
URL is that module's job.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
…past five

A tabs layout block stores which tab to open on, but the carousel always
started on the middle column, so /mooladhara-chakra, which lists its centre
aspect first, opened a phone on "Left Aspect". `startIndex` lets the caller
name the column; the middle one stays the default.

SahajCloud allows twelve tabs and the carousel kept five, dropping the
rest with a console warning a visitor never sees. The cap is now
SahajCloud's own twelve, and from six columns, which no longer fit side by
side, the carousel shows at every width instead of a desktop row.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
MasonryGrid was written after wemeditate.com's `.cb-grid-layout`, the old
rendering of the layout block's `grid` style, but could not render that
block: it took only a heading and a body, hard-coded `h3`, gave a linked
title no heading at all, dropped textarea line breaks, sliced every item
past the third out of the server's HTML, and laid out through
react-masonry-css.

It now takes each item's optional image, title, title link and text, a
`headingLevel` from its caller, and the `masonry` utility ContentGrid uses.
Every item reaches the server's markup; those past the first three carry
`hidden`, so they stay out of the accessibility tree and the tab order
until "Show More" reveals them. The button unmounts as it does, so focus
moves to the first revealed item rather than falling to <body>, and the
button is described (not named, #201) by `common.a11y.show_more_items`,
the existing key for exactly that count.

Three is hard-coded, as on the old site, because SahajCloud's block has no
count field; the default carries a `shortcut:` line.

With both grids on CSS, react-masonry-css has no importer and goes.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
Checked field by field against SahajCloud's LayoutBlock definition, the 18
live blocks and the old site (wemeditate.com's `.cb-grid-layout`,
`.cb-columns-layout` and `.cb-accordion-layout`, and its carousel script):

- `grid` renders through MasonryGrid: the /shri-mataji timeline shows three
  of its eleven moments and "Show More", as the old site did, and the home
  page's three links keep their titles inside the item headings.
- `tabs` opens on `defaultTab` (/mooladhara-chakra opened on its second
  tab), keeps every item, and no longer links each title to its own
  `#anchor`: SahajCloud derives that value from the title for `defaultTab`
  to match, and no element carries the id, so every tab title was a dead
  in-page link.
- `list` and `grid` read a bare-slug title link as a site path through
  `editorLinkHref`, so the three on
  /try-our-guided-course-to-explore-deeper-concepts get their hrefs.
- `accordion` keeps an item's image and title link, both of which the
  admin offers and the mapping dropped. The title is the toggle, so the
  link takes its words at the foot of the panel.

Two fields stay as they were, on evidence:

- Tabs draw no tab UI. The old site drew these blocks as columns on a wide
  screen and a one-at-a-time carousel below 920px, which is what
  ColumnCarousel already does, so the seven chakra pages keep their look.
- `useColumnsOnDesktop` is not read. All seven live tabs blocks store the
  field's default `false`, carried over from the old site's column blocks,
  so it records no editor's choice, and honouring it would turn every
  chakra page into one panel at a time on desktop. The converter carries a
  `shortcut:` line naming when to read it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
"Show More" is a click handler, so with scripting off it did nothing and
eight of the eleven /shri-mataji timeline entries stayed hidden for good,
against the walk-through's rule that body copy survives without JavaScript.
A `(scripting: none)` rule now shows the hidden items and drops the button.
It sits in `@layer base` because preflight's `[hidden]` is an `!important`
there, which no later layer can override. Checked in Chrome with
JavaScript off (11 items, no button) and on (3 items and the button).

The count that describes the button is now `hidden` rather than `sr-only`:
aria-describedby still computes it, and browse mode no longer reads it a
second time after the button.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
The grid's row gap spaces rows only, while the old per-card `mb-8` also
left 32px under the last card, so every content index ended 32px shorter.
`pb-8` on the grid restores it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
…desktop carousel

Ladle renders the story's JSDoc as its description, and it still said
desktop is always a flex row and the maximum is five. A six-column section
shows the carousel that now draws at every width from six columns.

The layout converter's `useColumnsOnDesktop` shortcut becomes the one line
the comment rule asks for; the live-data evidence behind it (all seven
tabs blocks store the imported default `false`, which the old site drew
as columns) lives here instead of in the code.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZcE8bs5uRJ6dsg6kw
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

This PR is stacked on claude/fix-popover-roles-and-accordion. Merge it into that branch, or retarget it to main: the loop does not work stacked PRs, so nothing runs here until then.

🤖 sydevs dispatcher

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-design ecbfa86 Commit Preview URL

Branch Preview URL
Nov 19 2026, 11:13 PM

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
wemeditate-web ecbfa86 Commit Preview URL

Branch Preview URL
Nov 19 2026, 11:13 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants