Repository navigation
fix(widget): compact card's overlay opens with no interface - #234
Conversation
…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]>
Deploying sahajatlas with
|
| 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 |
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying sahajatlas-design with
|
| Latest commit: |
24af7ea
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3001e295.sahajatlas-design.pages.dev |
| Branch Preview URL: | https://fix-compact-overlay-theme-ro.sahajatlas-design.pages.dev |
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
left a comment
There was a problem hiding this comment.
🧐 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>atz-index: 1000. - consider:
docs/embedding.md:457-460. Mesmerize wraps every in-content embed in az-index: 1stacking 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...5cd07f3across all 18 files. - Read whole:
Widget.tsx(AtlasBoot,PathBoot,Atlas, ownership and teardown) andApp.tsx's renderBrandTheme.tsx,use-theme.ts,lib/overlay.ts,use-published-node.ts, andpalette.ts'sapplyPaletteCompactEmbedView.tsx's dialog,MapFrame.tsx, the lightbox,MapSearch.tsx, andMapbox/themes.ts
- Grepped every
setThemeRoot/getThemeRoot/widgetOverlayContainer/document.bodysite insrc/, and every module-level element singleton (themeRoot,frame,reportOpener). The new hook's membership is complete, and nouseFrameimport 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.
- No Suspense boundary sits above
- Third-party layers:
- search-js-web 1.6.0 dist:
document.body.appendChild(this.listbox),.Results{…z-index:1000}, styles injected into<head>, no:hostand nopointer-eventsrule. - Radix Dialog 1.1.23 modal path:
hideOthers, andbody.style.pointerEvents = "none". - YARL portals through
overlayContainer(), so this PR does not affect it.
- search-js-web 1.6.0 dist:
- Consumers, on each repo's
origin/main:- WeMeditateWeb
pages/map/+Page.tsx,layouts/LayoutMap.tsx, andlib/atlas-embed.ts: a sized element with no capping ancestor. - SahajAtlasWordpress
templates/atlas-page.php,assets/atlas-page.{css,js},includes/embed.php, andblocks/embed/render.php, plus the companion sydevs/SahajAtlasWordpress#35.
- WeMeditateWeb
- 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.cssandtheme.bundle.min.csssupply the.site{display:flex}and.site>.content{z-index:1}rules behind the second finding.
- undici: the
package.json,pnpm-lock.yaml, andscripts/audit-baseline.jsonhunks are line-for-line identical togh pr diff 233. - Reviewer profile read from
claude-workfloworigin/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]' |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
| 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. |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
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]>
|
Addressed the adversarial review:
Lean gate: lint, typecheck, 🤖 Written by the sydevs autonomous loop — see what this is |
|
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 After this merges and deploys, 🤖 Written by the sydevs autonomous loop — see what this is |
* 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]>
…heme-root # Conflicts: # CHANGELOG.md # package.json # pnpm-lock.yaml
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]>
Summary
z-indexsits under the overlay's scrim instead of covering its controls and dismissing it.<html>.Changes
src/hooks/use-published-node.ts—useFramegeneralised tousePublishedNode(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;Apprenders once it exists.AppandBrandThemelose the ref prop;BrandThemeonly paintsgetThemeRoot().src/views/CompactEmbedView/CompactEmbedView.tsx— the scrim and frame share onez-[2147483000]constant.Preview
Contract impact
docs/embedding.mdandCHANGELOG.mdnow 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 itsz-50nav is intended. The WordPress plugin needs no change; its hero fix ships separately in sydevs/SahajAtlasWordpress#35.Test results
test:run(1620 passed)Widget.theme-root.test.tsx(3),MapFrame.test.tsx,CompactEmbedView/*— all passedassert:css,assert:maps;pnpm size✓ (embed 303.7 / 308 KiB);pnpm audit:check✓Manual verification
?atlas=/nlappended: the overlay opens straight onto the route with its interface.Notes for reviewer
useFrameis renamed and generalised rather than copied a third time. Its two frame callers now passsetFramethemselves.main(with chore(contracts): re-sync from https://github.com/sydevs/SahajCloud/pull/861 #233's undici override and feat(api): migrate widget intakes to unified form-submissions #213's changelog entry) is merged in, and the branch now carries no dependency change.!importantstill restyles widget text.Modalatom and the lightbox to the same z-index — rejected:SelectandComboboxin the report form portal beside the Modal atz-50, so raising it alone would bury them. No host has hit the Modal case.usePublishedNode— rejected: the two frames never coexist (src/lib/overlay.ts:34-39) and one widget runs per page; this matchesuseFrame's existing release.⚠onBrandTheme's prop — that line was added earlier on this branch;mainnever had it.Detail
Root cause.
Widget.tsxhandedBrandThemea ref to its own parent. React 18 attaches a parent's ref after its children's layout effects, soBrandThemeadopted<html>and recovered only when the client's colours changed later — never in path mode (PathBootcachesclients/mefirst) and never for a record with no colours.widgetOverlayContainer()then returneddocument.body, so the dialog rendered outside.sy-atlas, with nocontain: layout: the map'sfixed; inset: 0filled the window and the rest rendered unstyled below the page.docs/rules/mapbox.mdhad recorded this as a stub-only trap. The first fix on this branch held the node in state but still published fromBrandTheme'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/mestubbed without colours, host header atz-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-cssandpathmodeall render with drawers in scope.Regression specs were each seen to fail: with the publish moved into an effect, and with
BrandThemereleasing the root under StrictMode.Review passes.
/simplify(four lenses) and/code-review highran; thepr-review-toolkitplugin is not installed./security-reviewran (triggered bysrc/Widget.tsx,src/App.tsx,package.json): no findings.comment-lint: no banned comment added.Tool limitation.
branch-preview-url.mjsreturned 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