Repository navigation
Description
Summary
Let a map-mode embed be contained by an element on the host's page, instead of always taking the
whole viewport.
Today FullInterface renders the map as <div style={{ position: 'fixed', inset: 0 }}> with no
z-index, and docs/embedding.md states that map mode requires a full-page slot. That is a real
constraint and it was the right call at the time — but it now blocks a case we need.
Why now
The WordPress plugin (stage C5, sydevs/SahajAtlasWordpress) gives each site one plugin-owned Atlas
page. That page should show the site's own header, then the atlas below it. It cannot:
| Host header | What a visitor sees today |
|---|---|
| Static | The map paints over it. The header still occupies layout space, but is invisible. |
Sticky with z-index — Elementor Pro's default, and most modern themes |
The header floats above the map and above the widget's own drawers, covering the widget's top-left settings control. |
Neither is "header, then atlas". The plugin will ship without a header until this lands, which is a
worse page than the one we want on all 13 WordPress sites.
More generally: an embed that does not own the whole page is a shape we want to support, and
right now the only two options are "takes the viewport" or "no map at all".
⚠ The comment saying this is intractable is now stale
FullInterface.tsx:122-137 argues containment is not a fixed → absolute swap, because:
- vaul computes a snap-point sheet's translate from the window height, so a contained sheet is
pushed off-screen by the library's own arithmetic; and --sy-sheet-top, which pins the sticky Register bar, is a viewport-relative
getBoundingClientRect().top.
Both of those were solved in #161, and the whole interface is already contained in one place.
The compact card's expanded dialog is fixed inset-2 … [contain:layout]
(CompactEmbedView.tsx:93), and contain: layout makes it the containing block for every fixed
descendant — the map canvas, the drawers, the peek strips. FullInterface renders inside it as
children. It works.
The two obstacles were retired by:
--sy-frame-h—100dvhon.sy-atlas,100%on[data-sy-expanded](globals.css:112,
:427). One token that is correct in both places, because100%on a fixed child resolves
against its containing block.- vaul's own
containerprop —DrawerStackpassesmeasureAgainst={expandedDialog()}
(DrawerStack.tsx:745), so vaul measures the box it renders in rather than the window. Note the
distinction the code makes: the portal target and the measurement box are different props,
because the portal target can be adisplay: contentselement that measures 0×0. --sy-sheet-topalready subtracts the dialog's own top, and is zero everywhere else.
So the mechanism exists and is tested. This ticket is to generalize it from "a modal dialog we
own" to "an element on the host's page", not to build it.
What to work out
- How does the widget learn its container? Today
[data-sy-expanded]is the signal, set by our
own dialog. An embed on a host page has no such marker. Options worth weighing: measure the
custom element's own box; let the host mark an ancestor; or make the element itself the
containing block. Each interacts with §"Responsive: which signal answers which question" in
.claude/rules/components.md, which is the existing decision table for exactly this question. contain: layouton the scope root is currently forbidden, and for a good reason —
.claude/rules/components.mdsays so explicitly, and the measured table there showscontain
andtransformre-parent fixed descendants whilecontainer-typedoes not. Whatever this does
must not resurrect that hazard for map-less embeds.- The slot decision interacts.
lib/slot-decision.tscurrently renders the compact card when a
map embed does not own the viewport — that rule exists because containment was impossible. If
it becomes possible, the rule needs revisiting rather than leaving both behaviours to fight. z-index. The canvas has none. A contained map beside a host's sticky header needs a defined
stacking relationship rather than whatever the host's CSS happens to produce.- Does the host size it, or do we?
map=falseis container-relative and the host gives it a
height. The natural answer is the same for a contained map — but note the trap recorded in the
plugin plan: the widget degrades to the compact card when its slot is under 0.8× the viewport, so
"contained map mode" and "compact card" must not both trigger.
Not in scope
- Changing
map=false, which already works this way. - A script parameter for it. The plugin plan is explicit that configuration is a cost, and this
should follow from what the host's layout already says.
Consumers
sydevs/SahajAtlasWordpress— the atlas page wants the site header above the map. Blocked on
this for that feature only; the plugin ships without a header meanwhile.- Any future host embedding the map inside a page rather than dedicating one to it.
Metadata
Metadata
Assignees
Labels
Type
Fields
Hold Until
Activity
feat(map): let map mode be contained by an element, not only the view…
test(overlay): pin the two menus' ItemCheck against drift instead of …
fix(guides): a frame, not only the expanded dialog
docs(drawer): the prop's docblock agreed with neither the code nor th…
docs(guides): keep intent and gotchas, point at code for the rest (#453)