legend: open on the UPG-100 list, which is what the Driver asked for first
Some checks are pending
build-gate / build (push) Waiting to run

Measured at the rendered layer: the legend opened on REGION at desktop and
mobile. That is the Driver's first complaint about this legend word for word —
"it shouldn't have me sitting there on Regions, I don't know what to do, it's
confusing" — and the card recorded that part as shipped.

Every source signal said it worked. LEGEND_DEFAULT_TAB = 1 existed, defaultTab
was a declared prop, it seeded a local ref, and it was named in a watch fallback.

The root cause is one layer down. SemanticTreeLegend resolves its tab as
`instance ? instance.activeTab.value : localActiveTab.value`, and
usePplrInstance initialises activeTab to ref(0). Zero is indistinguishable from
"the user chose tab 0", so for every profile sharing an instance store the
defaultTab prop was dead — read on every render, never able to win. An
activeTabTouched sentinel fixes it: the store only wins once something actually
chose a tab, meaning a tab click or a node selection that jumps to that node's
generation. A sentinel rather than a new default, so no other profile's landing
tab moves as a side effect.

And a regression of my own, from the previous commit. There was only one
:default-tab left in the profile and it was on <LegendMobile>, where defaultTab
is not a prop. Last tick I "dropped the inert attribute" with a string replace
that matched the DESKTOP block first, deleting the working one and leaving the
inert copy. A dropped attribute is silent, so the build stayed green. Restored
to SemanticTreeLegend, and LegendMobile now has a real defaultTab prop so the
phone honours it too.

Both widths open on "UPG-100 Lists", and on ?lang=es both open on "Listas
UPG-100" — locale-independent. A user's own choice still sticks: clicking Region
holds at 0, and selecting a row does not snap back, so the sentinel is not a
trap.

check:legend-export-reachable still passes and now selects a real zone rather
than a region, because the legend opens on the Lists tab. The two fixes compound:
a phone user lands on the lists and can export the one they pick.
This commit is contained in:
doxa-maps-88655c70 2026-09-24 17:59:24 +00:00
parent f344b74334
commit 6e958bc22f
11 changed files with 116 additions and 54 deletions

View file

@ -292,6 +292,18 @@ const props = defineProps({
type: Array,
default: null
},
/** Which tab the sheet OPENS on, 0-based. Forwarded to SemanticTreeLegend below.
*
* ★ WHY IT HAD TO BE ADDED. The desktop legend has taken :default-tab for a while, and
* my-upg-100-list passes 1 (the UPG-100 Lists tab) because the Driver asked for exactly
* that — "it shouldn't have me sitting there on Regions, I don't know what to do, it's
* confusing". The mobile sheet had no such prop, so a phone opened on Region no matter
* what the profile declared: the same complaint, unfixed, on the surface prayer
* mobilisation most uses. Default 0 keeps every other consumer where it is. */
defaultTab: {
type: Number,
default: 0
},
/** Header label for the value column when supplying `nodes`. */
columnLabel: {
type: String,
@ -798,6 +810,7 @@ onBeforeUnmount(() => {
v-else-if="legendType !== 'default'"
:nodes="treeForMobile"
:tabs="tabsForMobile"
:default-tab="defaultTab"
:title="legendTitle || treeTitleForMobile"
:hideTabs="nodes ? !tabs : _isFlatTabMobile"
:columnLabel="treeColumnLabelForMobile"

View file

@ -207,15 +207,30 @@ const SHOW_EXPORT_BUTTON = true
const sortBy = ref(null) // null = default (pop desc), 'count' | 'pop'
const sortDir = ref('desc') // 'desc' | 'asc'
// ⚠ THE STORE USED TO WIN UNCONDITIONALLY, which made `defaultTab` dead for every profile
// that shares an instance. instance.activeTab starts at 0 and 0 is indistinguishable from
// "the user chose tab 0", so a profile passing :default-tab="1" still opened on tab 0.
// MEASURED 2026-09-24: my-upg-100-list opened on Region at desktop AND mobile, which is the
// Driver's first complaint about this legend word for word.
// Now the store only wins once something has ACTUALLY chosen a tab — a tab click, or a node
// selection that moves the legend to that node's generation (usePplrInstance sets the flag).
// Until then the profile's declared landing tab applies, which is what the prop always meant.
const activeTab = computed({
get: () => {
if (props.hideTabs) return 0
if (instance && !instance.activeTabTouched?.value) {
return Math.min(Math.max(0, props.defaultTab | 0), Math.max(0, tabList.value.length - 1))
}
return instance ? instance.activeTab.value : localActiveTab.value
},
set: v => {
if (props.hideTabs) return
if (instance) instance.activeTab.value = v
else localActiveTab.value = v
if (instance) {
instance.activeTab.value = v
if (instance.activeTabTouched) instance.activeTabTouched.value = true
} else {
localActiveTab.value = v
}
},
})
@ -238,11 +253,25 @@ watch(() => props.open, (v) => {
})
watch(() => safeNodes.value, () => {
const ext = instance?.activeTab.value
// Falls back to defaultTab, not a hardcoded 0 — otherwise a profile that opens on
// a deeper generation silently reverts to the top the first time its nodes change.
// ⚠ AND THE STORE ONLY COUNTS ONCE IT HAS BEEN TOUCHED. This read `instance?.activeTab.value`
// and kept it whenever it was `a number >= 0` — but the store's INITIAL value is 0, which
// satisfies that test, so defaultTab lost here too. Same root cause as the getter above.
const touched = instance ? instance.activeTabTouched?.value : false
const ext = touched ? instance?.activeTab.value : undefined
const base = Math.min(Math.max(0, props.defaultTab | 0), Math.max(0, tabList.value.length - 1))
activeTab.value = (typeof ext === 'number' && ext >= 0) ? ext : base
const next = (typeof ext === 'number' && ext >= 0) ? ext : base
// ⚠ WRITE PAST THE SETTER. This ran `activeTab.value = next`, and the setter marks the store
// TOUCHED — but a nodes-change reset is not a user choice, so that flipped the sentinel on
// mount and made defaultTab lose again, one layer down. Measured: the fix appeared to do
// nothing until this line changed. Set the store directly and leave `touched` alone.
if (instance) {
instance.activeTab.value = next
if (!touched && instance.activeTabTouched) instance.activeTabTouched.value = false
} else {
localActiveTab.value = next
}
expandedIds.value = new Set()
selectedNode.value = null
emit('select', null)

View file

@ -35,6 +35,22 @@ export function createPplrInstance(instanceId) {
/** Active legend tab index (0-based — but Tab 1 = Generation 1 in user-facing labels) */
activeTab: ref(0),
/** Has anything ACTUALLY chosen a tab yet — a user click, a search, a pin?
*
* ★ WHY THIS EXISTS. activeTab starts at 0, and 0 is indistinguishable from "the user
* picked tab 0". SemanticTreeLegend resolves its tab as
* `instance ? instance.activeTab.value : localActiveTab.value`, so for every profile
* that shares an instance store the `defaultTab` prop was DEAD — declared, passed,
* seeding a local ref, and named in a watch fallback, yet never able to win.
* MEASURED 2026-09-24: my-upg-100-list passes :default-tab="1" (the UPG-100 Lists tab)
* and opened on Region at BOTH widths, which is the Driver's first complaint about this
* legend verbatim — "it shouldn't have me sitting there on Regions, I don't know what to
* do, it's confusing."
* A sentinel rather than a different initial value: changing activeTab's default would
* move every other profile's landing tab as a side effect.
*/
activeTabTouched: ref(false),
/** Search-mode flag: true when geocoder text ≥ 2 chars */
isSearching: ref(false),
@ -80,6 +96,9 @@ export function selectNode(instance, node) {
instance.selection.value = node
if (typeof node.depth === 'number') {
instance.activeTab.value = node.depth
// A REAL choice — selecting a node moves the legend to that node's generation. Mark it,
// so the profile's defaultTab stops applying from here on (see activeTabTouched above).
instance.activeTabTouched.value = true
}
}

View file

@ -67,7 +67,7 @@
"check:locale-reachable": "node internal/check-locale-reachable.mjs",
"check:poster-prints": "node internal/check-poster-prints.mjs",
"check:provider-switch": "node internal/check-provider-switch.mjs # the provider switch must actually SWITCH: counts requests BY HOST (not window globals, which stay defined after a swap) and asserts the maplibre run stays within the leaf HTML's own declared api.mapbox.com preloads. Defaults to the upg-100 leaf; pass a URL or set BASE_URL for another. CONDITIONAL: SKIPs when nothing is served.",
"check:legend-export-reachable": "node internal/check-legend-export-reachable.mjs # the Export affordance must be reachable at BOTH widths. Selects a leaf row first (the control is gated on selectedNode) and opens the mobile sheet first (it starts closed). Asserts a REAL BOX, not CSS visibility — on mobile the elements report visibility:visible at 0x0. ⚠ CURRENTLY FAILS ON MOBILE BY DESIGN: the export lives in the desktop legend only, and WHERE it goes on a phone is a Driver call (BUG-UPG100-PACKET-AND-POSTER-EXPORT-ARE-UNREACHABLE-ON-A-PHONE). Not wave-wired until then. SKIPs when nothing is served.",
"check:legend-export-reachable": "node internal/check-legend-export-reachable.mjs # the Export affordance must be reachable at BOTH widths. Selects a leaf row first (the control is gated on selectedNode) and opens the mobile sheet first (it starts closed). Asserts a REAL BOX, not CSS visibility — on mobile the elements report visibility:visible at 0x0. PASSES at both widths since the mobile sheet was given :export-enabled and :tabs. SKIPs when nothing is served.",
"check:mfe-two-tab": "node internal/check-mfe-two-tab.mjs",
"check:share-policy": "node internal/check-share-policy.mjs",
"check:zone-census": "node internal/check-zone-census.mjs # every zone a USER CAN SELECT must have a poster (asks the LEGEND, not clusters.json — two collapsed deaf lists are unreachable and not a gap). CONDITIONAL: SKIPs without out/posters/, which is gitignored — run `bun run posters` first. It cannot be fixtured like check:packets-all, because it asserts COVERAGE of real generated output and a fixture would only assert the fixture is complete.",

View file

@ -1991,6 +1991,7 @@ onBeforeUnmount(() => {
v-if="legendNodes.length"
:nodes="legendNodes"
:tabs="LEGEND_TABS"
:default-tab="LEGEND_DEFAULT_TAB"
:columns="['count', 'pop']"
:title="LEGEND_TITLE"
:export-enabled="true"

File diff suppressed because one or more lines are too long

View file

@ -676,7 +676,7 @@
"bundle": "my-upg-100-list",
"scriptUrl": "./my-upg-100-list/my-upg-100-list.js",
"output": "doxa-maps/my-upg-100-list/my-upg-100-list.js",
"integrity": "sha384-xb5q69l8SauILfDQxPhCJeIaJ0JZVCOV5KhsOmbOrPbyAjr9y5Cjw+WmDUjN5IjB",
"integrity": "sha384-jGD6GdGzjAWNQ/APgKvUZDcXvryVdhvFXGLWNVENRfjZMurTwcMGmOUXDGF3wvnh",
"elements": [
"my-upg-100-list-map"
],
@ -696,7 +696,7 @@
"scriptUrl": "./my-upg-100-list/my-upg-100-list.js",
"embed": {
"iframe": "<iframe src=\"./my-upg-100-list/poster-wall/index.html?utm_source=YOUR_SOURCE\" width=\"100%\" height=\"600\" style=\"border:none;border-radius:12px;\" allowfullscreen></iframe>",
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./my-upg-100-list/my-upg-100-list.js\" integrity=\"sha384-xb5q69l8SauILfDQxPhCJeIaJ0JZVCOV5KhsOmbOrPbyAjr9y5Cjw+WmDUjN5IjB\" crossorigin=\"anonymous\"></script>\n<my-upg-100-list-map profile-config='{\"profile\":\"poster-wall\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></my-upg-100-list-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./my-upg-100-list/my-upg-100-list.js\" integrity=\"sha384-jGD6GdGzjAWNQ/APgKvUZDcXvryVdhvFXGLWNVENRfjZMurTwcMGmOUXDGF3wvnh\" crossorigin=\"anonymous\"></script>\n<my-upg-100-list-map profile-config='{\"profile\":\"poster-wall\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></my-upg-100-list-map>"
}
},
{
@ -710,7 +710,7 @@
"scriptUrl": "./my-upg-100-list/my-upg-100-list.js",
"embed": {
"iframe": "<iframe src=\"./my-upg-100-list/upg-100-list/index.html?utm_source=YOUR_SOURCE\" width=\"100%\" height=\"600\" style=\"border:none;border-radius:12px;\" allowfullscreen></iframe>",
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./my-upg-100-list/my-upg-100-list.js\" integrity=\"sha384-xb5q69l8SauILfDQxPhCJeIaJ0JZVCOV5KhsOmbOrPbyAjr9y5Cjw+WmDUjN5IjB\" crossorigin=\"anonymous\"></script>\n<my-upg-100-list-map profile-config='{\"profile\":\"upg-100-list\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></my-upg-100-list-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./my-upg-100-list/my-upg-100-list.js\" integrity=\"sha384-jGD6GdGzjAWNQ/APgKvUZDcXvryVdhvFXGLWNVENRfjZMurTwcMGmOUXDGF3wvnh\" crossorigin=\"anonymous\"></script>\n<my-upg-100-list-map profile-config='{\"profile\":\"upg-100-list\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></my-upg-100-list-map>"
}
},
{
@ -724,7 +724,7 @@
"scriptUrl": "./my-upg-100-list/my-upg-100-list.js",
"embed": {
"iframe": "<iframe src=\"./my-upg-100-list/upg-100-mfe/index.html?utm_source=YOUR_SOURCE\" width=\"100%\" height=\"600\" style=\"border:none;border-radius:12px;\" allowfullscreen></iframe>",
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./my-upg-100-list/my-upg-100-list.js\" integrity=\"sha384-xb5q69l8SauILfDQxPhCJeIaJ0JZVCOV5KhsOmbOrPbyAjr9y5Cjw+WmDUjN5IjB\" crossorigin=\"anonymous\"></script>\n<my-upg-100-list-map profile-config='{\"profile\":\"upg-100-mfe\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></my-upg-100-list-map>"
"script": "<script>window.MAP_APP_API_URL=\"https://pray.doxa.life\";</script>\n<script src=\"./my-upg-100-list/my-upg-100-list.js\" integrity=\"sha384-jGD6GdGzjAWNQ/APgKvUZDcXvryVdhvFXGLWNVENRfjZMurTwcMGmOUXDGF3wvnh\" crossorigin=\"anonymous\"></script>\n<my-upg-100-list-map profile-config='{\"profile\":\"upg-100-mfe\",\"tk\":\"YOUR_MAPBOX_TOKEN\",\"utmSource\":\"YOUR_SOURCE\",\"assetsBase\":\"YOUR_TREE_URL/assets\"}'></my-upg-100-list-map>"
}
}
]

File diff suppressed because one or more lines are too long

View file

@ -26,7 +26,7 @@
<script>window.MAP_APP_API_URL = "https://pray.doxa.life";</script>
<!-- Bundle IIFE — registers the <my-upg-100-list-map> custom element. -->
<script src="../my-upg-100-list.js" integrity="sha384-xb5q69l8SauILfDQxPhCJeIaJ0JZVCOV5KhsOmbOrPbyAjr9y5Cjw+WmDUjN5IjB" crossorigin="anonymous"></script>
<script src="../my-upg-100-list.js" integrity="sha384-jGD6GdGzjAWNQ/APgKvUZDcXvryVdhvFXGLWNVENRfjZMurTwcMGmOUXDGF3wvnh" crossorigin="anonymous"></script>
<script>
// Mapbox token resolution — the A3 ladder, in precedence order:

View file

@ -29,7 +29,7 @@
<script>window.MAP_APP_API_URL = "https://pray.doxa.life";</script>
<!-- Bundle IIFE — registers the <my-upg-100-list-map> custom element. -->
<script src="../my-upg-100-list.js" integrity="sha384-xb5q69l8SauILfDQxPhCJeIaJ0JZVCOV5KhsOmbOrPbyAjr9y5Cjw+WmDUjN5IjB" crossorigin="anonymous"></script>
<script src="../my-upg-100-list.js" integrity="sha384-jGD6GdGzjAWNQ/APgKvUZDcXvryVdhvFXGLWNVENRfjZMurTwcMGmOUXDGF3wvnh" crossorigin="anonymous"></script>
<script>
// Mapbox token resolution — the A3 ladder, in precedence order:

View file

@ -40,7 +40,7 @@
<script>window.MAP_APP_API_URL = "https://pray.doxa.life";</script>
<!-- Bundle IIFE — registers the <my-upg-100-list-map> custom element. -->
<script src="../my-upg-100-list.js" integrity="sha384-xb5q69l8SauILfDQxPhCJeIaJ0JZVCOV5KhsOmbOrPbyAjr9y5Cjw+WmDUjN5IjB" crossorigin="anonymous"></script>
<script src="../my-upg-100-list.js" integrity="sha384-jGD6GdGzjAWNQ/APgKvUZDcXvryVdhvFXGLWNVENRfjZMurTwcMGmOUXDGF3wvnh" crossorigin="anonymous"></script>
<script>
// Mapbox token resolution — the A3 ladder, in precedence order: