Skip to content

fix(widget): compact card's overlay opens with no interface - #234

Merged
Ardnived merged 10 commits into
mainfrom
fix/compact-overlay-theme-root
Oct 1, 2026
Merged

Ardnived merged 10 commits into
mainfrom
fix/compact-overlay-theme-root

Conversation

@Ardnived

@Ardnived Ardnived commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The compact card's full-screen overlay renders its whole interface again, in path mode and for clients with no brand colours.
  • A host header with a high z-index sits under the overlay's scrim instead of covering its controls and dismissing it.
  • The light/dark setting no longer writes its class onto the host's <html>.

Changes

  • src/hooks/use-published-node.ts — useFrame generalised to usePublishedNode(publish), now the one hook for both module singletons: the frame (setFrame) and the theme root (setThemeRoot).
  • src/Widget.tsx — publishes its wrapper as the theme root from the callback ref; App renders once it exists. App and BrandTheme lose the ref prop; BrandTheme only paints getThemeRoot().
  • src/views/CompactEmbedView/CompactEmbedView.tsx — the scrim and frame share one z-[2147483000] constant.

Preview

Contract impact

docs/embedding.md and CHANGELOG.md now state the overlay's stacking (z-index: 2147483000) and the ancestors that cap it. Consumers checked: WeMeditateWeb sizes its element (pages/map/+Page.tsx), so it reaches the overlay only on a slot under the floors, where covering its z-50 nav is intended. The WordPress plugin needs no change; its hero fix ships separately in sydevs/SahajAtlasWordpress#35.

Test results

  • Lean gate: ✓ lint + typecheck + test:run (1620 passed)
  • Targeted specs: Widget.theme-root.test.tsx (3), MapFrame.test.tsx, CompactEmbedView/* — all passed
  • Build: ✓ assert:css, assert:maps; pnpm size ✓ (embed 303.7 / 308 KiB); pnpm audit:check ✓

Manual verification

  1. On https://shrimataji.org/test/kn/find-a-class/ after deploy, at 900×480: press "Find a class near you". The drawer, search, cog and × show, and the site header sits under the dimmed margin.
  2. Click inside the overlay: it stays open. Click the margin or press Escape: it closes.
  3. Open the same page with ?atlas=/nl appended: the overlay opens straight onto the route with its interface.

Notes for reviewer

Detail

Root cause. Widget.tsx handed BrandTheme a ref to its own parent. React 18 attaches a parent's ref after its children's layout effects, so BrandTheme adopted <html> and recovered only when the client's colours changed later — never in path mode (PathBoot caches clients/me first) and never for a record with no colours. widgetOverlayContainer() then returned document.body, so the dialog rendered outside .sy-atlas, with no contain: layout: the map's fixed; inset: 0 filled the window and the rest rendered unstyled below the page. docs/rules/mapbox.md had recorded this as a stub-only trap. The first fix on this branch held the node in state but still published from BrandTheme's effect, one render late; the simplify pass caught that an auto-opened dialog mounted on <body> before remounting.

Browser verification (pnpm review:embed, Playwright, clients/me stubbed without colours, host header at z-index: 100): in query and path routing the dialog is a child of .sy-atlas, fixed, z-index 2147483000; ×, cog and drawer are hit-testable inside it; an inside click keeps it open, a margin click closes it; <html> is untouched. Typing "London" in the overlay's search shows the suggestion list inside the dialog, on top, and a click routes to /search. An auto-opened deep link (?atlas=/nl) mounts the dialog inside the wrapper with zero <body> inserts, in both routings. full-map, contained-map, sidebar-map, sidebar-mapless, hostile-css and pathmode all render with drawers in scope.

Regression specs were each seen to fail: with the publish moved into an effect, and with BrandTheme releasing the root under StrictMode.

Review passes. /simplify (four lenses) and /code-review high ran; the pr-review-toolkit plugin is not installed. /security-review ran (triggered by src/Widget.tsx, src/App.tsx, package.json): no findings. comment-lint: no banned comment added.

Tool limitation. branch-preview-url.mjs returned only the design alias, because Cloudflare posts both projects in one comment. The app alias above is read from that same comment, not derived.

Closes #235

🤖 Generated with Claude Code

…lay above host chrome

The wrapper was handed to BrandTheme as a ref to its own parent, which React
attaches only after the child's layout effect runs. The effect adopted <html>
and recovered only if the client's colours changed later — never in path
mode or for a record with no colours. Every portal then landed on the host's
<body>, outside the scoped stylesheet: the compact card's dialog opened as a
bare full-viewport map with no drawer, search or close button (seen live on
shrimataji.org). The wrapper is now state, and App renders once it exists.

The expanded dialog sat at z-50 in the host's stacking context, so a theme
header at z-index 100 painted over its controls and a click there dismissed
it. It now uses z-index 2147483000.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 24af7ea
Status: ✅  Deploy successful!
Preview URL: https://edadb1c9.sahajatlas.pages.dev
Branch Preview URL: https://fix-compact-overlay-theme-ro.sahajatlas.pages.dev

View logs

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Ardnived and others added 6 commits September 30, 2026 13:22
The Dependency Audit gate fails on GHSA-rfgv-xxqx-mfg5 and
GHSA-w293-vg96-wgc3 in undici 7.29.0, which `payload` pins exactly. The
failure exists on main too; #233 carries the same override. These hunks
are byte-identical to it, so whichever lands first, the other merges clean.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
BrandTheme still published the wrapper from its own layout effect, which runs
after every descendant's first render. On a warm cache (path mode) a
deep-linked compact dialog read `widgetOverlayContainer()` in that render and
mounted on the host's <body> before remounting inside the wrapper.

`useFrame` becomes `usePublishedNode(publish)`, the one hook for both module
singletons: the frame (`setFrame`) and now the theme root (`setThemeRoot`).
Widget publishes from the callback ref, so App's first render already sees
the wrapper. BrandTheme only paints `getThemeRoot()` and no longer releases
the root: the ref's null call does, and StrictMode's simulated unmount would
otherwise clear a root nothing republishes. The dialog's two layers share one
z-index constant.

`Widget.theme-root.test.tsx` replaces the BrandTheme spec. It asserts every
render of App's subtree sees the wrapper under StrictMode, and pins the
wiring in Widget.tsx. Verified to fail with the publish moved into an effect,
and with BrandTheme releasing the root.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The changelog entries now describe the symptom a host saw rather than the
theme-root mechanism, and reuse the existing [compact card] link. The guide's
overlay bullet notes that an ancestor stacking context caps the overlay's
z-index.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Two comments still named BrandTheme as the owner of the release.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ning

The stacking-context limit now sits beside the containing-block warning it
belongs with, and the overlay bullet points at both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The StrictMode case already fails if BrandTheme releases the root, so the
source check on BrandTheme.tsx goes. The App gate regex tolerates a
reflow. The hook's docblock drops its history.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived Ardnived changed the title fix(embed): adopt the theme root on mount, and stack the compact overlay above host chrome fix(widget): compact card's overlay opens with no interface Sep 30, 2026

@Ardnived Ardnived left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

The theme-root half is what #235 prescribed, and no bigger. The wrapper publishes from its callback ref and App waits for it. That runs through the hook MapFrame and the dialog already used, generalised to usePublishedNode instead of copied a third time. BrandTheme loses its ref prop and its release. The z-index half is where the shape is thin. An int32 value in the host's stacking context lifts the dialog over the host's header. It also lifts it over the search's suggestion list, the one part of our own interface that lives on <body>. On the ticket's own theme it holds only for the Atlas page template. The contract side is sound: the embed guide and the changelog both move, and neither in-tree consumer needs a change.

Findings

  • should-fix: src/views/CompactEmbedView/CompactEmbedView.tsx:99. The dialog now paints over the Geocoder's suggestion list, which search-js-web appends to <body> at z-index: 1000.
  • consider: docs/embedding.md:457-460. Mesmerize wraps every in-content embed in a z-index: 1 stacking context, so a host there cannot act on this caveat. Was the top layer weighed?
  • consider: CHANGELOG.md:260. In path mode the old bug also wrote the brand palette onto the host's <html> as inline CSS variables, and the entry names only the class.

What was checked

  • Ticket #235 (approach, acceptance criteria, verification list), the PR body, its 8 commits, and git diff origin/main...5cd07f3 across all 18 files.
  • Read whole:
    • Widget.tsx (AtlasBoot, PathBoot, Atlas, ownership and teardown) and App.tsx's render
    • BrandTheme.tsx, use-theme.ts, lib/overlay.ts, use-published-node.ts, and palette.ts's applyPalette
    • CompactEmbedView.tsx's dialog, MapFrame.tsx, the lightbox, MapSearch.tsx, and Mapbox/themes.ts
  • Grepped every setThemeRoot / getThemeRoot / widgetOverlayContainer / document.body site in src/, and every module-level element singleton (themeRoot, frame, reportOpener). The new hook's membership is complete, and no useFrame import survives.
  • Timing:
    • No Suspense boundary sits above Atlas, so a re-suspend cannot hide the wrapper and detach its ref.
    • On unmount the wrapper's ref detaches before BrandTheme's layout cleanup, so nothing writes to <html> in between.
  • Third-party layers:
    • search-js-web 1.6.0 dist: document.body.appendChild(this.listbox), .Results{…z-index:1000}, styles injected into <head>, no :host and no pointer-events rule.
    • Radix Dialog 1.1.23 modal path: hideOthers, and body.style.pointerEvents = "none".
    • YARL portals through overlayContainer(), so this PR does not affect it.
  • Consumers, on each repo's origin/main:
    • WeMeditateWeb pages/map/+Page.tsx, layouts/LayoutMap.tsx, and lib/atlas-embed.ts: a sized element with no capping ancestor.
    • SahajAtlasWordpress templates/atlas-page.php, assets/atlas-page.{css,js}, includes/embed.php, and blocks/embed/render.php, plus the companion sydevs/SahajAtlasWordpress#35.
  • Live host: fetched shrimataji.org/test/kn/find-a-class/.
    • <sahaj-atlas> is a direct child of #page.site, beside .header-top{position:absolute;z-index:100}, so this z-index does clear that header.
    • Mesmerize's style.min.css and theme.bundle.min.css supply the .site{display:flex} and .site>.content{z-index:1} rules behind the second finding.
  • undici: the package.json, pnpm-lock.yaml, and scripts/audit-baseline.json hunks are line-for-line identical to gh pr diff 233.
  • Reviewer profile read from claude-workflow origin/main.
  • Nothing built or run: no lint, tests, or browser. The first finding comes from stacking arithmetic, not a screenshot.

🤖 Written by the sydevs autonomous loop — see what this is

// ⚠ **Both layers stack in the HOST's stacking context**, so they must outrank its
// chrome: a header painted over them hides the controls, and a click on it counts as
// outside and closes the dialog. Below the int32 maximum, so a host layer can still win.
const aboveHost = 'z-[2147483000]'

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should-fix — This value lifts the dialog over the host's header. It also lifts it over the one piece of our own interface that renders outside the widget. MapSearch's Geocoder (search-js-web 1.6.0) appends its suggestion list to document.body (document.body.appendChild(this.listbox)), styled .Results{position:absolute;…;z-index:1000}, with no :host or wrapper rule to lift it. On the Atlas page the list and this dialog share the root stacking context. At z-50 the list painted above the dialog. At 2147483000 the scrim covers it, so a place typed into the overlay's search should now show no suggestions.

The pointer half is older than this PR. Radix's modal sets body.style.pointerEvents = "none", and the list inherits it.

Did the browser pass type a query inside the overlay? If this reproduces, the Geocoder's theme.cssText (organisms/Mapbox/themes.ts) is the only handle on the list's styles.

🤖 Written by the sydevs autonomous loop — see what this is

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked in a browser on this branch's build: it does not reproduce. The Geocoder mounts its mapbox-search-listbox inside the input's wrapper, so the list sits inside [data-sy-expanded]. Typing "London" in the overlay shows five suggestions on top, pointer-events: auto. Clicking one keeps the dialog open and routes to ?atlas=/search?q=London…. The library's document.body.appendChild path is not the one the Geocoder takes here.

🤖 Written by the sydevs autonomous loop — see what this is

Comment thread docs/embedding.md
Comment on lines +457 to +460
element a height instead** — the supported way to say the same thing. Those properties, and any
ancestor that forms a stacking context — a positioned element with a `z-index`, `opacity` below 1,
or `isolation: isolate` — also cap the overlay's `z-index` at that ancestor's level, so a header
outside it can still cover the overlay.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider — This cap is real on the theme that motivated #235. Mesmerize makes .site a flex container and gives its content wrappers .site>.content, .site>.page-content{z-index:1}. That puts any shortcode or block embed inside a stacking context at level 1, while .header-top{position:absolute;z-index:100} sits outside .site. On shrimataji.org this fix holds only because the Atlas page template prints <sahaj-atlas> straight into .site. A host on that theme cannot follow this advice, because the capping element is the theme's own content wrapper.

This is a question, not a request, since nobody has counted a compact embed in Mesmerize content yet. The platform's answer to "above everything the host stacks" is the top layer. A popover="manual" wrapper opened with showPopover() escapes every ancestor stacking context, and the transform/contain confinement in the ⚠ above as well. It would not fix the Geocoder list on the other thread. Was it weighed against z-[2147483000]?

🤖 Written by the sydevs autonomous loop — see what this is

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weighed, and kept z-index. The Popover API needs Chrome 114, Firefox 125 and Safari 17. The guide's floor is Chrome 111, Firefox 114, Safari 16.4 (docs/embedding.md § Browser support). It would also end "give it a higher z-index" for hosts, and Radix Dialog plus vaul's nested layers would need rebuilding on it. The capped case is real but uncounted: the plugin's in-content embeds sit at 520–640px, and the Atlas page prints into .site. The ⚠ tells a host why.

🤖 Written by the sydevs autonomous loop — see what this is

Comment thread CHANGELOG.md Resolved
In path mode the old bug wrote the palette onto the host's <html> as inline
CSS variables on every load, not only the light/dark class.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived

Copy link
Copy Markdown
Contributor Author

Addressed the adversarial review:

Lean gate: lint, typecheck, test:run (1620 passed). CI green on the previous head.

🤖 Written by the sydevs autonomous loop — see what this is

@Ardnived
Ardnived marked this pull request as ready for review September 30, 2026 21:35
@Ardnived

Ardnived commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

The plugin's browser lane (sydevs/SahajAtlasWordpress#38) confirms the production widget's overlay defect in every theme before this deploys. All 19 compact overlays it opened — 16 on landscape-phone Atlas pages, 3 in sidebar embeds — rendered outside .sy-atlas (position: static), with its drawer not hit-testable.

After this merges and deploys, pnpm test:browser in the plugin repo should report none of those findings.

🤖 Written by the sydevs autonomous loop — see what this is

Ardnived added a commit to sydevs/SahajAtlasWordpress that referenced this pull request Oct 1, 2026
* fix(test): pin Playground versions with preferredVersions, not flags

The guide said `server` ignores a blueprint's `preferredVersions` and to pass
`--php`/`--wp` instead. Under @wp-playground/cli 3.1 the reverse holds:
given a blueprint, the flags are ignored, and a blueprint without the key
boots WordPress 7.1 on PHP 8.5. Measured: render-classic.json with
`--php 8.3 --wp 7.1` serves WordPress 6.7.9 on PHP 7.4.33; the same
blueprint without the key, with `--php 7.4 --wp 6.7`, serves 7.1.2 on 8.5.8.
The render lane was right only because both blueprints carry the key.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* test(browser): run the production widget in real themes, in Chromium

A fourth lane, `pnpm test:browser`, local only. Each cell boots a Playground
WordPress 6.7 / PHP 7.4 with a theme from wordpress.org, loads the Atlas page
in Chromium with the production widget (clients/me and clients/report
stubbed, PHP still offline), and measures at four viewports: whether the
interface or the compact card rendered and why, the slot against the
widget's floors, the header against the element, hit-testing of the search
box and the compact overlay's chrome, portal placement, and probes for host
CSS reaching the widget. Screenshots go to a gitignored directory.

Cells: the eleven free themes the fleet runs, Elementor and Beaver Builder
Lite on WordPress 6.8, and hostile conditions (async CSS, a fixed header,
a 62.5% root font, a z-index wrapper, the admin bar, a stripped module tag).

Verdicts: FAIL is the plugin's and fails the run; KNOWN is an exposure
already ticketed (#35, #37, #40); WIDGET is a production-widget finding
(sydevs/SahajAtlasWeb#234, #236, #238 and #239 in that repo). First full
run: 0 failures, 47 known, 109 widget findings.

Closes #38

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* docs(test): rewrap the browser lane's header

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(test): address the code review of the browser lane

- A `known` cell no longer waives invariants. Checks split into `ok`
  (served, PHP never reached SahajCloud, no error panel — fail everywhere),
  `fit` (how the page fits the theme — KNOWN in a ticketed cell) and
  `widget`. Verified: a known cell whose PHP calls SahajCloud now fails.
- Chromium launches once, before any server, and a failed launch names the
  install command instead of orphaning a server. AGENTS.md documents
  `pnpm exec playwright-core install chromium` and states the GL trap
  correctly: headless Chromium needs the software-GL flags.
- The header probe ignores headers inside the widget.
- `--only` refuses an empty or unknown cell name instead of a green no-op.
- Escape closing the overlay is the widget's verdict, not the plugin's.
- The sidebar check confirms the card is the card, not any unlabelled
  button in a full interface.
- A server that exits fails its cell at once, with its output saved.
- The two API stubs live in one helper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(test): judge the plugin by the widget's documented surface

From the adversarial review of #44:
- The plugin's verdicts no longer read widget internals. The compact-card
  decision comes from the warning the embed guide documents; the size check
  is the plugin's own contract — the element runs to the viewport's bottom —
  instead of a copy of the widget's floors. A landscape phone at 844×390 can
  no longer fail the plugin for a decision the widget made correctly.
- Every overlay verdict, including opening it, is the widget's.
- Mesmerize is no longer `known`: #35 shipped, and the cell now passes.
  `strip-module` cites SahajAtlasWeb#239.
- The client stub says why `allowedDomains: 'localhost'` matters (it keeps
  the widget's analytics off), drops the unread `locale`, and names the
  SahajCloud client the test key belongs to.
- The ignored `--php`/`--wp` flags are gone; the summary no longer asks for
  duplicate tickets.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
@Ardnived Ardnived reopened this Oct 1, 2026
@sydevs-bot sydevs-bot moved this from Done to Revising in SYDevelopers Technical Roadmap Oct 1, 2026
…heme-root

# Conflicts:
#	CHANGELOG.md
#	package.json
#	pnpm-lock.yaml
@Ardnived
Ardnived merged commit 62e1d07 into main Oct 1, 2026
10 checks passed
@Ardnived
Ardnived deleted the fix/compact-overlay-theme-root branch October 1, 2026 18:44
sydevs-bot pushed a commit that referenced this pull request Oct 1, 2026
GitHub reported the PR conflicting. The one conflict was the CHANGELOG's
link-reference list: #223 here and #234 on main both appended a definition
after #220. Both entries exist in the file, so both definitions stay, in
number order. No entry text on either side was touched.

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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.

fix(widget): compact card's overlay opens with no interface

2 participants