Skip to content

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

Closed

Description

@Ardnived

Summary

On a host page where the slot is too small, the compact card's button opens a full-viewport map with no drawer, search, cog or close button, and a click on the host's header closes it. Seen live on https://shrimataji.org/test/kn/find-a-class/ (WordPress, Mesmerize Pro, routing=path) at 1280×720 and 390×844. Two independent causes, both confirmed in a browser.

Approach

  • Theme root never adopted. src/Widget.tsx hands BrandTheme a ref to its own parent wrapper. React 18 attaches a parent's ref only after its children's layout effects run, so BrandTheme (src/config/theme/BrandTheme.tsx:53-66) reads null and adopts <html>. It recovers only if the client's colours change afterwards — never in path mode (PathBoot has already cached clients/me) and never for a record with no colours. widgetOverlayContainer() (src/lib/overlay.ts:101) then returns document.body, so the expanded dialog renders outside .sy-atlas with none of the scoped stylesheet: no contain: layout, so the map's fixed; inset: 0 fills the window and the rest renders unstyled below the page. Fix: hold the wrapper in state through a callback ref and render App once it exists — the contract src/hooks/use-frame.ts already documents.
  • Overlay under host chrome. The dialog's scrim and frame are z-50 (src/views/CompactEmbedView/CompactEmbedView.tsx:98-103) in the host's stacking context. Mesmerize's header is z-index: 100, so it paints over the search, cog and ×, and a click there counts as outside and dismisses. Fix: a z-index near the top of the int32 range.

Acceptance criteria

  • With a client record carrying no brand colours, in query and path routing, the expanded dialog is a child of .sy-atlas and renders the full interface.
  • A host header with z-index: 100 sits under the overlay's scrim, and the overlay's ×, cog and drawer are hit-testable.
  • A click inside the overlay keeps it open. A click on its margin, or Escape, closes it.
  • The light/dark setting never writes a class onto the host's <html>.
  • docs/embedding.md and CHANGELOG.md describe the overlay's stacking.

Verification checklist

  • pnpm test:run passes, including a jsdom spec that fails against the ref-based wrapper.
  • pnpm build && pnpm review:embed, then in Playwright with clients/me stubbed without color1–color3, on a host page with a z-index: 100 header and a slot under 420px: press "Find a class near you"; document.querySelector('[data-sy-expanded]').parentElement has class sy-atlas, and elementFromPoint at the × lands inside [data-sy-expanded].
  • After deploy, https://shrimataji.org/test/kn/find-a-class/ at 900×480 opens the overlay with its drawer visible.

Notes

docs/rules/mapbox.md recorded the theme-root failure as a review-stub trap and believed production recovered. It does not in path mode.
Companion host-side fix: the WordPress plugin stops printing Mesmerize's hero on the Atlas page (sydevs/SahajAtlasWordpress).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Fields

    Priority

    High

    Hold Until

    None yet

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions