Skip to content

feat(embed): gestures=cooperative lets the host page scroll past a contained map - #251

Merged
Ardnived merged 1 commit into
mainfrom
feat/cooperative-gestures
Oct 5, 2026
Merged

Ardnived merged 1 commit into
mainfrom
feat/cooperative-gestures

Conversation

@Ardnived

@Ardnived Ardnived commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • New script parameter gestures=cooperative. A contained map uses Mapbox's cooperative gestures with it on: one finger and the mouse wheel scroll the host page, and the map moves on two fingers or Ctrl/⌘ + wheel, with Mapbox's hint overlay saying so.
  • It only applies when the map is contained. A window-filling map and the compact card's full-screen overlay ignore it, because there is no page behind them to scroll.
  • Off by default, and it switches on only for the exact value cooperative, the same rule as routing=path. No current host changes.
  • docs/embedding.md (six parameters now) and CHANGELOG.md are updated.

Why: the WordPress plugin's [sahaj_atlas] shortcode is about to show the map by default, inside ordinary pages. Without this, a visitor scrolling the page with the cursor or a finger over the map zooms or pans it and can't get past. The plugin's own Atlas page fills the screen and doesn't scroll, so it won't send this.

Changes

  • src/loader/config.ts: cooperative on LoaderConfig, read from gestures.
  • src/views/FullInterface.tsx: passes contained && embed.config.cooperative to <Mapbox>.
  • src/components/organisms/Mapbox/Map.tsx: forwards it to cooperativeGestures. This is a constructor option in mapbox-gl 3.32, and one widget per page means reuseMaps never mixes values.
  • Tests: the parameter is parsed only from its exact spelling. MapFrame.test.tsx's wiring check now accepts the prop.

Test results

  • pnpm vitest run src/loader src/views/MapFrame.test.tsx: 114 passed.
  • The pre-PR check script passed. pnpm build passed, including the CSS-scoping assertion.
  • The WordPress browser lane will run its shortcode cells against this PR's preview, with results posted here.

🤖 Generated with Claude Code

…ntained map

A map sized into a page took every wheel and one-finger gesture, so a
visitor scrolling down an article got stuck on the map. `gestures=
cooperative` turns on Mapbox's cooperative gestures for a contained map:
the page scrolls, and the map moves on two fingers or Ctrl/⌘ + wheel.
A window-filling map and the compact card's overlay ignore it.

The WordPress plugin's shortcode and block embeds will send it.

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

cloudflare-workers-and-pages Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

Deploying sahajatlas with  Cloudflare Pages  Cloudflare Pages

Latest commit: 27f397a
Status: ✅  Deploy successful!
Preview URL: https://8e5690ea.sahajatlas.pages.dev
Branch Preview URL: https://feat-cooperative-gestures.sahajatlas.pages.dev

View logs

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying sahajatlas-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 27f397a
Status: ✅  Deploy successful!
Preview URL: https://178a9e6a.sahajatlas-design.pages.dev
Branch Preview URL: https://feat-cooperative-gestures.sahajatlas-design.pages.dev

View logs

@Ardnived

Ardnived commented Oct 5, 2026

Copy link
Copy Markdown
Contributor Author

The WordPress browser lane confirms the fix. sydevs/SahajAtlasWordpress#61's new article check puts a bare [sahaj_atlas] between paragraphs in Astra. The map is full width at 3:4. The check then sends a mouse-wheel scroll over the middle of the map:

Widget Result
Production the page doesn't move, and the map zooms
This preview (8e5690ea) the page scrolls past the map

The astra cell's other checks have no failures on this preview, including the sidebar compact card and its overlay. The overlay ignores the parameter, as intended.

@Ardnived
Ardnived merged commit 68b63c4 into main Oct 5, 2026
10 checks passed
@Ardnived
Ardnived deleted the feat/cooperative-gestures branch October 5, 2026 21:36
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.

1 participant