Skip to content

feat(map): one control column for find-me, settings and the credits - #482

Merged
Ardnived merged 17 commits into
mainfrom
feat/map-control-column
Nov 25, 2026
Merged

Ardnived merged 17 commits into
mainfrom
feat/map-control-column

Conversation

@Ardnived

@Ardnived Ardnived commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The map's buttons sit together top right: find-me, then settings, with Mapbox's credits "i" beside them.
  • Both buttons are themed in every state (dark too), show their name on hover or keyboard focus, and turn into a row in a short window.
  • Joined: every <button> shows the pointer cursor again, which Tailwind 4's Preflight had dropped widget-wide.

Change outline

Components — the map's controls are one Mapbox control

The cog leaves DrawerStack and joins find-me and the credits in one custom control, so Mapbox's position prop still places the whole corner and no stylesheet rule moves it.

 <Mapbox>                                           src/components/organisms/Mapbox/Map.tsx
-  locale={mapLocale}                               # Mapbox's find-me strings; nothing left to localise
   <GeolocateControl …
+    ref, showButton={false}                         # Mapbox's logic, our button
   />
-  <AttributionControl compact position="top-right" />
+  <MapControls locate onLocate locateRef />        src/components/organisms/Mapbox/MapControls.tsx (memo)
+    useControl(ControlColumn, { position: 'top-right' })
+    useMapControls.hidden → the whole column visibility: hidden
+      root: [Mapbox's compact AttributionControl element] [slot]
+    portal into slot:
+      <div flex-col | flex-row when useIsShortViewport()>
+        <HoverLabel "Find my location"><Button floating> LocateFixed | Spinner </Button></HoverLabel>
+        <SettingsMenu labelled align="end" />
 <DrawerStack>                                      src/views/DrawerStack/DrawerStack.tsx
-  <SettingsMenu className="fixed … start-[drawer-w+16px] …" />   # cog beside the panel
+  useMapControls.setHidden(bottom sheet at its near-full stop)   # else the column peeks as slivers

Flow — find-me

Our button drives Mapbox's control, so the blue dot, permission prompt and failure dialog are Mapbox's as before.

 tap find-me → locate()                             src/components/organisms/Mapbox/use-locate.ts
+  a request already out → ignore
+  control.trigger()
+    true  → 'waiting' (spinner)
+    false → not set up yet: 'waiting', ask again on the control's `ready`
+    throws (no geolocation on the page) → 'failed' + the "could not get a location" dialog
 onGeolocate → 'found' (primary glyph) → geolocateToSearch(position)
 onError     → 'failed' (danger glyph) + dialog
-dialog closes → focus `.mapboxgl-ctrl-geolocate` via a DOM query
+dialog closes → focus our button via its ref

Files — new pieces

 src/components/atoms/
+├── HoverLabel/    # a control's name drawn out of its end as one pill; mouse hover + keyboard focus, never touch
+│                  #   grows left, or right when the frame or window leaves no room on the left
 src/components/organisms/Mapbox/
+├── use-locate.ts  # find-me's state, in-flight guard, ready retry and failure dialog, out of Map.tsx
 src/config/
 ├── store.ts       # + useMapControls: whatever covers the map hides the whole control column
 src/styles/
 ├── base.css       # + button / [role=button] cursor: pointer, under :where()
 └── globals.css    # credits seated in the column, touch-target tap area, #370's dark fix kept for the "i" only

Preview

  • App — preview pending (the Workers preview is published by CI; open /gb/south-east/london once it is)
  • Component library — preview pending: Atoms › Hover Label, Molecules › Settings Menu

Contract impact

Visible to host pages, no contract change: the cog moves from beside the panel to the map's top-right corner, and Mapbox's own locate button (.mapboxgl-ctrl-geolocate) is no longer shown. CHANGELOG.md and docs/embedding.md (Permissions Policy row, the tap-size note) are updated. No parameter, origin, CSP, storage or Permissions-Policy change, so WeMeditateWeb's lib/atlas-embed.ts and the WordPress plugin need nothing.

Test results

  • Lean gate --full: ✓ lint, typecheck, unit lane, build (incl. CSS scoping check), size budget
  • attribution.test.ts: 13 passed — each new assertion watched failing first
  • pnpm test:a11y: 3 findings, all also on main (the Mapbox wordmark link's tap size, two registration tab-order findings); main also fails on its old find-me button, which this fixes
  • Flaky on main too: Modal.focus*.test.tsx fail about 1 run in 4, untouched here
  • Review round, main merged in (f796b68): ✓ lint, typecheck, 2414 unit tests

Manual verification

  1. 1280×800, /gb/south-east/london: "i", find-me and settings top right; hovering each button draws its name out of it; Tab does too.
  2. Settings menu opens under the cog, aligned to its right; closing it with a click does not light the cog's label.
  3. Dark theme (settings › Dark): buttons, labels, "i" and the opened credits are dark.
  4. Find-me with location allowed (green glyph, search near you) and blocked (red glyph, dialog, focus back on find-me).
  5. 844×390: the buttons run as a row above the sheet.
  6. On a real iPhone, portrait and landscape: nothing under the status bar or Dynamic Island (not checked).

Notes for reviewer

  • The scope grew in review with the owner: find-me first, the credits as Mapbox's stock "i" beside the column (not restyled), and the hover labels. The cursor fix is widget-wide, not map-only.
  • The cog's per-view hide is gone (the store, the DrawerStack effect and the branch). Both stops it fired at cover the whole column: the wide calendar's drawer is !inset-0 / lg:!inset-4, the column's own 16px box, and the 0.97 sheet's top edge sits under 16px on any short viewport. The cog is also second in the column, so find-me covers it first either way.
  • Dismissed findings: 'found' and 'failed' tints persist, raised by /code-review and again by the critic — 'found' tracks the blue dot, which stays, and 'failed' reports the last answer until the next tap, so it outlives its dialog. HoverLabel keeps its own input tracking: @floating-ui/react's useFocus is :focus-visible alone on Chrome, its modality listeners being behind isMacSafari(), and that is the read a menu's returned focus defeats.
  • /simplify items left as they are: fading the border and shadow in Button's floating variant (it would fade every floating button's focus ring too), deriving labelled from floating (the label's wrapper would capture a caller's positioning), and deriving suppressed from aria-expanded with :has().
Detail

🤖 Generated with Claude Code

Ardnived and others added 10 commits November 25, 2026 09:02
The map had three buttons in two corners and three shapes: the 32px settings cog
beside the panel, and Mapbox's square find-me and solid "i" in the far corner,
which stayed white in the dark theme. All three are now one top-right column of
matching round buttons, 40px (44px on a touch screen), 8px apart and 16px in,
themed in every state. A window 480px tall or less runs them as a row.

The column is ONE Mapbox control (`MapControls`), so Mapbox's `position` prop
still places it and no stylesheet rule moves a corner:

- Settings and find-me are floating Buttons. Find-me drives Mapbox's
  GeolocateControl with its own button hidden (`showButton={false}`), so the
  blue dot, permission flow and failure dialog are unchanged, and a permission
  denied before the map loaded now reaches the dialog instead of a disabled
  button.
- The credits are Mapbox's own compact AttributionControl, appended to the
  column; only its look is restyled in globals.css. #370's invert-filter dark
  rules go with the controls they styled.
- DrawerStack no longer renders the cog. It publishes when the cog is hidden
  (full-width calendar, the sheet's near-full stop) through `useSettingsCog`.

Ports the intent of 384b966 and 29dcb12 (ux/map-controls) onto today's main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…de the column

- Find-me now leads the column, above settings.
- Each shows its name in a new Tooltip atom (Radix Tooltip), skinned like the
  map's opened credits, on hover and on keyboard focus, never on touch. A
  focus opens it only after a key press, so the cog does not light its own
  label every time its menu closes.
- The credits go back to Mapbox's stock compact "i", level with the column's
  top and to its left, inside the same control, so they stay visible above the
  phone sheet. globals.css only resets Mapbox's corner margin and float there,
  adds a 44px touch tap area, and restores #370's dark-theme fix for it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The hover labels on find-me and settings are now one pill growing leftward out
of the button, the shape Mapbox's credits button takes when opened, rather than
a detached tooltip. `HoverLabel` replaces the Tooltip atom, so the Radix
Tooltip dependency goes again. Same rules: mouse hover and keyboard focus,
never touch, and hidden while the settings menu is open.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Tailwind 4's Preflight dropped v3's cursor: pointer on buttons, so every
button in the widget showed the arrow. One rule in base.css restores it,
under :where() so a cursor utility still wins and disabled buttons keep the
arrow.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Resolves #476's DrawerStack, attribution.test.ts and AGENTS.md against the
control column: the floating cog stays out of DrawerStack, and the peek
strips' removal and the SNAP_POINTS assertion come from main.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- MapControls is memoised and gets a stable onLocate, so the map's hover and
  camera re-renders no longer redraw the settings menu.
- The column/row switch reads useIsShortViewport, the signal that caps the
  phone sheet in a short window, instead of a second hard-coded 480px.
- The credits' touch area is the touch-target utility, not a copy; the
  overflow rule beside it targeted a clip Mapbox does not apply.
- Find-me tints its glyph from a lookup; HoverLabel keeps its open styles in
  one variant.
- attribution.test.ts checks the class names against mapbox-gl's own sheet,
  so a rename upstream fails it.
- Stale "the cog is fixed" notes, a cog-offset note and the old localised
  labels note are gone; Checkbox and Dropdown drop cursor-pointer classes the
  base rule now covers.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- A tap before Mapbox's control has finished its setup used to do nothing:
  it now waits for the control's `ready` and asks then.
- A page with no geolocation at all made `trigger()` throw; that now opens
  the failure notice, as a denied permission does.
- A second tap while a request is out is ignored, so one answer cannot
  navigate twice.
- HoverLabel's document listeners are reference-counted and leave with the
  last label, rather than staying on the host page.

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

@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.

1 question for the reviewer, one per thread.

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

@sydevs-dispatcher

sydevs-dispatcher Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

🤖 no session running

recent dispatches
  • 18:06Z address-review · attempt 1 · session · done
  • 18:06Z address-review · attempt 1 · session
  • 17:53Z review-pr · attempt 1 · session · done
  • 17:53Z review-pr · attempt 1 · session

Written by the sydevs dispatcher. Sessions never edit this comment.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Updated (UTC)
✅ Deployment successful!
View logs
sahajatlas-design 972da03 Nov 25 2026, 06:39 PM

@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Pending to Working in SYDevelopers Technical Roadmap Nov 25, 2026

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧐 Adversarial review

The shape is right, and the hard part justified. One useControl whose element lays out its own children is what docs/rules/mapbox.md leaves open once no stylesheet rule may move Mapbox's corner, and the credits stay Mapbox's to keep the one collapsed form its guide sanctions. Against mapbox-gl 3.35.0 the behaviour claims hold: denied-before-load really does reach the dialog now. No contract change — no parameter, origin, CSP, storage or Permissions-Policy row moves, and the geolocation row's wording matches the code.

Two things to settle: the cog's hide removes it from a column it leaves standing, and five module globals with document listeners track input modality that @floating-ui/react, already a dep, tracks for you.

Findings

  • should-fix — MapControls.tsx:105: the cog hides; find-me and the credits do not.
  • should-fix — HoverLabel.tsx:32: Streamline the input tracking onto @floating-ui/react.
  • should-fix — Map.tsx:381: Streamline locationFailed, a copy of locate === 'failed'.
  • should-fix — MapControls.tsx:19: Streamline LOCATE_TINT inline.

Settled the open question (the pill over the credits) as A, and resolved it.

What was checked

  • Read whole on the branch: MapControls, HoverLabel, Map.tsx's locate block, SettingsMenu, DrawerStack, store.ts, both stylesheets, the test.
  • mapbox-gl 3.35.0: trigger() is false only while _setup is unset, which _setupUI sets before firing ready; _onError fires error whatever trackUserLocation is; AttributionControl.onRemove takes no map argument; the credits button's dark filter still reaches the span .mapboxgl-ctrl-icon used to.
  • The locale prop's removal orphans no key; the map-less cog is unaffected (DrawerStack.tsx:702).
  • Streamliner: 16 pieces, 8 kept, 3 of 5 findings posted.

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


Generated by Claude Code

Comment thread src/components/organisms/Mapbox/Map.tsx Resolved
@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
claude and others added 4 commits November 25, 2026 18:07
`useSettingsCog` removed the cog from a column that is covered whole in both
cases it fired. The full-width calendar's drawer is `!inset-0` (`lg:!inset-4`),
the same box the column sits in at 16px; the sheet's 0.97 stop puts its top edge
at 3% of the frame, which on a short viewport is above the column's own top. The
cog is also the second control in the column, so find-me covers it before either
drawer does. Where a top edge did show, find-me and the credits showed theirs
beside it.

So the hide was never visible, and `docs/rules/i18n-and-state.md` said as much
already. The store, the `DrawerStack` effect and the branch go with it.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYeifwR5hWFNyKADbF
The pill measures the room either side of its button as it opens, against
the frame or the window, and mirrors (button at its left end) when the left
cannot fit it. The story shows both sides.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A two-entry lookup and its `Partial<Record<…>>` were read once, four lines
below their declaration.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjYeifwR5hWFNyKADbF

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

1 question for the reviewer, one per thread.

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


Generated by Claude Code

@sydevs-bot

Copy link
Copy Markdown
Contributor

Base merged clean (f796b68), pushed here. The reviewer's A stands as built.

Adopted

Rebutted

  • HoverLabel's globals — useFocus is :focus-visible alone on Chrome, the read this quirk defeats.
  • locationFailed — a dismissal clears it and leaves locate === 'failed'.

Asked

⚠ The PR body was edited at 18:15Z, mid-run.

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


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Nov 25, 2026
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Working to Awaiting in SYDevelopers Technical Roadmap Nov 25, 2026
@sydevs-dispatcher

Copy link
Copy Markdown
Contributor

The newest commit, 4730e37, is sydevs-bot's own, so it is not approved on your behalf. Read it, then say @sydevs-bot approve, or enable auto-merge.

🤖 sydevs dispatcher

Ardnived and others added 2 commits November 25, 2026 11:36
…y control

- Find-me's state, in-flight guard, ready retry and failure dialog state move
  from Map.tsx into `Mapbox/use-locate.ts`; Map.tsx keeps the wiring.
- `useSettingsCog` becomes `useMapControls`, hiding the whole column rather
  than the cog alone. DrawerStack sets it only at the phone sheet's near-full
  stop, where find-me and the credits used to peek as slivers above the sheet;
  on the desktop calendar the panel already covers the column whole.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Takes the loop's #481 merge and its glyph-tint expression. Its 78d0d76
dropped the cog's hide on the claim that both drawers cover the column whole.
They do on the desktop calendar, but at a 390x844 phone's near-full stop the
sheet's top sits at 25px and the column's at 16px, so find-me and the credits
showed 9px slivers above it (measured). The owner chose one switch that hides
the whole column there (`useMapControls`), which also serves the inline view's
toolbar later, so this side of those hunks is kept.

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

@sydevs-dispatcher sydevs-dispatcher Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approved for Ardnived, who wrote it: GitHub refuses an author's own approval. CI is green and the automated review has run. Enable auto-merge when you want it merged: the queue tests it against its base. 🤖 Written by the sydevs autonomous loop — see what this is

@Ardnived
Ardnived added this pull request to the merge queue Nov 25, 2026
Merged via the queue into main with commit 7e8fe27 Nov 25, 2026
35 checks passed
@Ardnived
Ardnived deleted the feat/map-control-column branch November 25, 2026 18:48
@sydevs-dispatcher sydevs-dispatcher Bot moved this from Awaiting to Done in SYDevelopers Technical Roadmap Nov 25, 2026
sydevs-bot pushed a commit that referenced this pull request Nov 25, 2026
#482 made the map's top-right corner one control column holding find-me,
settings and Mapbox's credits, and took the cog out of DrawerStack. This
branch had moved the same cog into the inline heading row and put "Close map"
at the bottom middle of the expanded map.

- DrawerStack portals the sheet origin and "Close map" only. Settings live in
  MapControls now, and main's useMapControls effect for the sheet's near-full
  stop arrives with it.
- The inline heading row keeps its ghost cog for a map-less embed alone. With
  a map, the column owns settings, and both rendering showed the same menu
  twice.
- SettingsMenu keeps side, align and labelled. Nothing passes side any more,
  since the map-less drawer strip that did is deleted here.
- globals.css drops [data-sy-expanded]'s 40px nudge, as this branch had it:
  it cleared the compact card's corner collapse control, and the exit is now
  "Close map" at the bottom middle. main's .sy-map-controls credits rules stay.
- CHANGELOG keeps both entries; src/components/AGENTS.md keeps main's map
  controls row and this branch's anchored-panel wording.
- CompactEmbedView.tsx, MapFrame.tsx and MapFrame.test.tsx stay deleted; main
  only edited comments in them.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Mg9rjZAZHuFE1VSqyzx9ni
Ardnived added a commit that referenced this pull request Nov 26, 2026
#482 hides the map's control column while a phone sheet stands at its near-full stop, which would otherwise leave a row of slivers above it. A narrow inline column takes that stop for the calendar too, but covers no map, so the inline map lost find-me, settings and Mapbox's credits on every narrow /calendar. The hiding now asks for a sheet that can collapse, as the rest of the sheet behaviour does.

Watched failing first: the new browser-lane scenario, with the old condition.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ardnived added a commit that referenced this pull request Nov 26, 2026
The "Calendar" heading belongs to the loading chrome alone; the view names its switch instead. The spec caught the heading while the view was still loading, so it passed or failed on timing. It now waits for the switch: 3 of 3 red with #482's old condition, 6 of 6 green with the fix.

Co-Authored-By: Claude Opus 5.5 <[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.

3 participants