Repository navigation
Description
Summary
When the browser refuses the map's location request, tapping "Find my location" does nothing visible: no message and no next step, so it looks broken. Say what happened, in a dialog over the map.
Approach
1. A dialog on onError, not an inline alert
<GeolocateControl followUserLocation={false} onGeolocate={geolocateToSearch} /> has no onError (src/components/organisms/Mapbox/Map.tsx:524).
- Hold the failure in
Map.tsxlocal state:const [locationFailed, setLocationFailed] = useState(false), set fromonError={() => setLocationFailed(true)}. AuseStatesetter has a stable identity, so this handler needs none of the live-ref machineryuseGeolocateToSearchcarries. - Render the dialog as a sibling of
<ReactMapGL>, in a fragment, rather than a child — nothing about it belongs to the map's own subtree. - Use the
Modalatom (src/components/atoms/Modal/Modal.tsx):Modal+ModalContent+ModalFooterwith aModalClose-wrappedButton. The footer button gives touch a target bigger than the header ×.ModalContentportals throughoverlayContainer(), so it inherits the theme root and the brand variables, and sits atz-50above the drawer stack. Radix owns Esc, the focus trap, and focus return to the locate control. - Copy:
title={t('common.map.location_not_available')}andcloseLabel={t('common.chrome.close')}already exist.descriptioniscommon.map.location_failed, shipped by feat(translations): add the geolocate-failure message to sy-atlas-translations SahajCloud#1031:We couldn’t get your location. Search for a place instead.— a curly apostrophe, as seeded. That merge also widenedlocation_not_available's own description to name this dialog's heading as its second role, so reuse that key for the heading rather than adding one. - The sentence must be live in production before this build can finish. feat(translations): add the geolocate-failure message to sy-atlas-translations SahajCloud#1031 declared and seeded the key, but production's global still answers
common.mapwithfind_my_locationandlocation_not_availableonly (read 2026-10-26 23:55Z). A manager adds it — see## Decisions. Until it is there,pnpm sync:translations --writewrites a snapshot without the key andsrc/config/translations.test.tsfails on the new call site. - Do not put the place search inside the dialog.
Map.tsxcannot importsrc/views/shared.tsx, which is whereSearchFieldlives:shared.tsximportsMapSearchfrom the organisms barrel, which re-exportsMapbox, so that is a real cycle (src/hooks/use-geolocate.tsrecords it). The dialog says what happened and points at the search; the field stays in the header it already sits in.
What onError reaches, and the one case it cannot
Read off node_modules/mapbox-gl/dist/mapbox-gl-dev.js ([email protected]), not inferred:
GeolocateControl.onAddcalls_checkGeolocationSupport, which queriesnavigator.permissions.query({ name: 'geolocation' })and hands_setupUIsupported: falsewhen the state is alreadydenied._setupUIthen renders the buttondisabledwith theGeolocateControl.LocationNotAvailabletitle. A disabled button fires no click, sotrigger()never runs and noerrorevent is ever emitted. So a permission blocked before the map loaded — the ordinary Chrome and Firefox case — cannot be caught byonErrorat all. The only signal there is the disabled control plus atitle, which is invisible on touch.onErrordoes fire for: declining the browser prompt, a position that is unavailable, the 6-secondpositionOptions.timeout(and_startRequestTimeout's own code-3 fallback), and a pre-blocked permission in Safari, whosepermissions.queryrejects forgeolocationso mapbox leaves the button enabled.trackUserLocationis false here — we pass onlyfollowUserLocation={false}, and the default is false — so_onError's disable-and-relabel branch does not run. The button stays live after a refusal, and a second tap re-prompts.- The event payload is a plain object,
{ code, message, PERMISSION_DENIED, POSITION_UNAVAILABLE, TIMEOUT }, not aGeolocationPositionError. One dialog for every code is enough; do not branch oncode.
Making the pre-blocked, disabled control speak would mean replacing Mapbox's own control. That is out of proportion to this bug and is not in this ticket.
2. Correct the handler-binding note the fix sits next to
docs/rules/mapbox.md ("Localizing Mapbox's own control strings") says Mapbox reads onGeolocate once at construction, and concludes "treat anything handed to a Mapbox control as bound once". The conclusion is safe; the mechanism is wrong. node_modules/react-map-gl/dist/esm/components/geolocate-control.js assigns thisRef.current.props = props on every render, and every listener it registers reads the handler off that ref — so a control's handlers are live. What made useGeolocateToSearch stale was its own useCallback(…, []).
Leave the hook's code alone: the [] deps and the live ref are still correct. Fix the explanation in both places — that paragraph in docs/rules/mapbox.md and the matching docblock in src/hooks/use-geolocate.ts — so a later author does not reason from the wrong mechanism. The locale prop on <ReactMapGL> genuinely is construction-only; that half of the note stands.
3. Give sync:translations the select the client gate now requires
pnpm sync:translations is the only sanctioned way the new key reaches src/config/translations.en.json, and it fails against production today, for every key — so it is this ticket's to fix.
scripts/sync-translations.mjs:105 builds ${PRODUCTION}/api/globals/sy-atlas-translations?locale=en&depth=0 with no select. SahajCloud rejects any API-client read that sends none (src/plugins/usage/hooks.ts:285, 400, The "select" query parameter is required for API clients). Measured against production on 2026-10-26 with a clients key: that URL answers 400; the same URL plus select[<tab>]=true for each of the script's own ten WIDGET_TABS (scripts/sync-translations.mjs:60) answers 200 and carries the whole widget bundle. The runtime path was never affected — src/config/api/fetch.ts:736 declares TRANSLATION_SELECT and sends it at :817. The node script is the one reader with no select.
- Append one
select[<tab>]=trueperWIDGET_TABSentry. Add no new list:src/config/translations.test.ts:170already pins that array againstWIDGET_TRANSLATION_TABS, and a second spelling of the tabs would escape it. That test reads the array witharrayLiterals(script, 'const WIDGET_TABS[^=]*='), soWIDGET_TABSmust stay a plain array literal — build the query string from it. - The 200 body carries
idandevent.title, whichDROPand the explicitdelete bundle.event.titlealready remove, so the stripping stage needs no change.emailsis simply never selected now; leave it inDROP. scripts/sync-translations.mjs:109throwsGET … answered 400. Is the key a production client key?— a wrong diagnosis for this failure, and the reason it reads as a credential problem. Include the response body in that message.
Acceptance criteria
- Declining the browser's location prompt opens a dialog naming what happened, with no perceptible delay.
- A location request that times out, or returns no position, opens the same dialog.
- Esc and the dialog's own Close both dismiss it, and focus returns to the locate control.
- The dialog renders inside the widget's theme root, not on the host page's
document.body. -
docs/rules/mapbox.mdandsrc/hooks/use-geolocate.tsno longer say a Mapbox control's handlers are construction-bound, and both name the hook's ownuseCallback(…, [])as what made the handler stale. -
pnpm sync:translationsreaches production and reports drift instead of throwing on a 400. - The script still spells the widget tabs exactly once, and
src/config/translations.test.tspasses unchanged. -
pnpm test:runpasses,src/config/translations.test.tsincluded, with the new key wired to its one call site.
Verification checklist
- First, confirm production carries the copy. It did not at 2026-10-26 23:55Z, and nothing below can pass until it does. With
ATLAS_API_KEYset to a production client key:
bash curl -gs 'https://cloud.sydevelopers.com/api/globals/sy-atlas-translations?locale=en&depth=0&select[common]=true' \ -H "Authorization: clients API-Key $ATLAS_API_KEY" | grep location_failed
No match means the manager edit in## Decisionshas not happened yet. Stop and say so. -
pnpm sync:translations(no--write), with the same key: it answers with a drift report, notanswered 400. Watch it fail on the current script first, so the fix is proven rather than assumed. -
pnpm sync:translations --write, then confirmsrc/config/translations.en.jsongainedcommon.map.location_failed, thenpnpm test:run src/config/translations.test.ts. The snapshot is generated, never hand-edited. -
.claude/skills/pr-prep/check.sh. - Browser, attended, through the Playwright MCP — this repo has no Playwright lane (
pnpm test:smokeis fetch-only). Servepnpm devwithclients/mestubbed, perdocs/rules/mapbox.md→ "Checking map behavior in a browser", and install this before the page loads:
js await page.addInitScript(() => { Object.defineProperty(navigator, 'permissions', { value: { query: async () => ({ state: 'prompt', onchange: null }) }, }) Geolocation.prototype.getCurrentPosition = (_ok, fail) => fail({ code: 1, message: 'User denied Geolocation', PERMISSION_DENIED: 1, POSITION_UNAVAILABLE: 2, TIMEOUT: 3, }) })
Then clickbutton.mapboxgl-ctrl-geolocateand screenshot: the dialog shows the new sentence. Re-run withcode: 3for the timeout path. Thestate: 'prompt'half matters — it is what keeps the control enabled. - Same page with the stub answering
state: 'denied': the control rendersdisabledand no dialog appears. This is the out-of-scope path above — observe the limit rather than assume it.
Open questions
- 1. Production serves two keys this repo references nowhere. How do they clear? The copy blocker above is gone —
common.map.location_failedis live, and the branch takes it into the snapshot. But the same publish broughtevent.display.roomandregistration.form.subscribe, andsrc/config/translations.en.jsonis generated wholesale, so both land in it too.src/config/translations.test.ts:229fails any snapshot key the source references nowhere ("drop it in SahajCloud"), sopnpm test:runis red on those two and on nothing else.roomis fix(event): show the venue's room in the class view #316's, already in flight.subscribeis feat(widget): submit or correct a class, and opt into a mailing list #147's, unbuilt — and feat(widget): submit or correct a class, and opt into a mailing list #147 phase 1 gates the opt-in onoffersMailingList, whichgetEventDoc'sselectdoes not yet carry, so it is not a small wiring job.- A — A manager removes
subscribefrom the production global until feat(widget): submit or correct a class, and opt into a mailing list #147 wires it (recommended). It restores the invariant the assertion encodes, costs one admin edit, and feat(widget): submit or correct a class, and opt into a mailing list #147 republishes the key beside its checkbox. Unblocks this ticket and fix(event): show the venue's room in the class view #316 together. - B — Allowlist a key published ahead of its call site, by name, in that assertion. This conflicts with nothing else, and it answers a general problem: every new key now spends a window live in production and unreferenced, because the other direction of the same spec requires the key to resolve before a
t()call can land (chore(translations): enter the production English copy for event.display.room SahajCloud#1025's whole story). During that window any sync of the snapshot reddens the lane, for a key belonging to a third ticket. Costs the assertion some of its teeth, and needs a rule for pruning the list. - C — Wire the opt-in checkbox here. Out of this ticket's scope, ahead of feat(widget): submit or correct a class, and opt into a mailing list #147's
offersMailingListplumbing, and it would collide with feat(widget): submit or correct a class, and opt into a mailing list #147.
- A — A manager removes
Decisions
- How does
common.map.location_failedreach production's copy? → A — a manager adds the sentence at/admin/globals/sy-atlas-translations(Ardnived, 2026-10-26). Paste the seeded English exactly:We couldn’t get your location. Search for a place instead.Rejected:pnpm seed translationsagainst production, which rewrites every seeded group wholesale and would replace copy a manager has since reworded. Done 2026-10-28 (chore(translations): enter the production English copy for event.display.room SahajCloud#1025); aclientsread at 05:28Z answers with the sentence.
Notes
Found in a whole-Atlas UX audit (2026-10-25).
The reviewer asked for a dialog over the earlier inline-alert-plus-focus-move plan (2026-10-25). That also retires the old "focus moves to the place search" criterion: a Radix dialog traps focus in itself and hands it back to the control on close.
The select fix joins this ticket because it is what lets this ticket's own verification run: one reviewer, one sitting. ⚠ #316 part 4 specifies the same fix, and #316 is in flight — whichever lands first, the other rebases onto it.
The stored location_failed value carries two trailing newlines, from the paste. Harmless on screen, and the snapshot copies production faithfully, so fixing it is a SahajCloud admin edit rather than anything here.
@sydevs-bot implement starts the work, once the sentence is live in production's sy-atlas-translations.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Hold Until
Projects
- StatusShow more project fieldsDone
Activity
Ardnived commentedon Oct 25, 2026
@sydevs-bot revise this to use an alert or modal or whatever the simplest solution is, instead of it being inline.
sydevs-bot commentedon Oct 25, 2026
🤖 no session running
recent dispatches
Written by the sydevs dispatcher. Sessions never edit this comment.
sydevs-bot commentedon Oct 25, 2026
Rewritten for a dialog:
onErroropens aModalfromMap.tsxlocal state. Radix traps focus and hands it back to the control, so the old "focus moves to the search field" criterion is gone.Two things the code forced:
onErrorcannot catch the headline case. mapbox-gl queriesnavigator.permissionsatonAddand renders the buttondisabledwhen the state is alreadydenied, so Chrome and Firefox emit no event for a permission blocked before load. The dialog covers the prompt refusal, a timeout, an unavailable position, and Safari's pre-blocked case. Replacing Mapbox's control is out of proportion, so that path is out of scope.common.map.location_failed, plus theBlocked by:line. Title and close label reuse keys that exist.Joined in:
docs/rules/mapbox.mdsays a Mapbox control's handlers bind once at construction. react-map-gl refreshes them every render — the stale handler was the hook's ownuseCallback(…, []).@sydevs-bot implementstarts the work once #1031 ships.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
20 remaining items
sydevs-bot commentedon Oct 27, 2026
Not started: production still does not carry the sentence.
A
clientsread of production'ssy-atlas-translationsat 00:40Z answerscommon.mapwithfind_my_locationandlocation_not_availableonly.common.map.location_failedis absent.Decision 1A asks a manager to add it at
/admin/globals/sy-atlas-translations, pasting exactly:We couldn’t get your location. Search for a place instead.I built nothing. The ticket is one PR, and
pnpm sync:translations --writewould write a snapshot without the key, sosrc/config/translations.test.tsfails on the dialog's new call site. The docs correction and theselectfix ride the same PR, so neither ships ahead of it.Say
@sydevs-bot implementagain once the sentence is live.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
Ardnived commentedon Oct 28, 2026
@sydevs-bot implement —
common.map.location_failedis now in production's sy-atlas-translations global (added and published 2026-10-28, sydevs/SahajCloud#1025).sydevs-bot commentedon Oct 28, 2026
Built, not shipped: one assertion is red on two keys this ticket cannot reference.
Branch
claude/fix-321-location-blocked, four commits, no PR. The dialog, the docs correction and theselectfix are all done, and the lean gate is green but for one case.The copy blocker cleared:
location_failedis live, read 05:28Z. That same publish also broughtevent.display.room(#316, in flight) andregistration.form.subscribe(#147, unbuilt). The snapshot is generated wholesale, so both land in it, andtranslations.test.ts:229reddens on any snapshot key the source references nowhere.Question 1 in the body asks how they clear. Recommended: a manager removes
subscribefrom the production global until #147 wires it — that unblocks #316 too.Still owed: the attended browser pass. This container has no
VITE_MAPBOX_ACCESSTOKEN, so no map can be constructed to click.Answer with
@sydevs-bot revise 1A, thenimplementagain.🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
fix: show the venue's room, and say why Find my location failed (#316, …