From d0196eaf5e9b491513f9c741e1da50eb72ce16f6 Mon Sep 17 00:00:00 2001 From: Raymond Yee Date: Thu, 21 May 2026 12:23:12 -0700 Subject: [PATCH] explorer: in-map detail card + unified click semantics (#226) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the floating in-map detail card from Hana Figma 222:456 / 225:1700, anchored near the clicked sample dot with viewport-edge collision avoidance. Same data path as the side-panel sample card; the floating card is the new map-anchored surface companion. Unifies click semantics across map dot and samples table (#226): click = open detail card; the external link to the source record (OpenContext, SESAR, etc.) lives inside the card title, never as the row's default action. Previously the table title rendered as and the row-click handler bailed on anchor targets, so clicking the title opened the external site while clicking elsewhere updated the panel — the most-attractive click target did the least-useful thing. Lazy-load now resolves vocabulary URIs to human labels via vocab_labels.parquet, so Material / Specimen Type render as e.g. "Biogenic non-organic material" / "Architectural element" instead of the raw w3id.org URI strings. Wide-parquet only — no narrow-format references. Codex-reviewed iteration: * XSS-hardened: escapeHtml() on all interpolated values; thumbnail image built via DOM construction, not innerHTML, so the onerror fallback is a property rather than an inline-JS attribute string. * Removed the table-row card-vs-detail race: card now shows immediately at canvas centre (where the sample lands after the camera flyTo), rather than deferring to flyTo.complete and racing the detail query. * z-index bumped to 1001 so the card stays above the search overlay, results line, and color legend (all at 1000). * Table title is now a role="button" tabindex="0" span with aria-label, not an . Keeps the blue-underline visual styling; screen readers announce as a button (correct) rather than a link (misleading). Keyboard parity via Enter/Space handler on .table-link. Pre-deploy smoke gate (#225) passes locally: 1 passed in 12.75s. Followup: #227 tracks the same click-semantics fix for the nearby-samples and search-results panels (separate PR to keep this diff focused). Co-Authored-By: Claude Opus 4.7 (1M context) --- explorer.qmd | 367 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 349 insertions(+), 18 deletions(-) diff --git a/explorer.qmd b/explorer.qmd index 3a4b93f..e955f23 100644 --- a/explorer.qmd +++ b/explorer.qmd @@ -246,6 +246,75 @@ format: .legend-item input[type="checkbox"] { margin: 0; width: 12px; height: 12px; cursor: pointer; } .source-badge { color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.8em; white-space: nowrap; } .cluster-card { border-left: 4px solid #ccc; padding: 10px 12px; background: white; border-radius: 0 6px 6px 0; } + /* In-map detail card (Hana Figma node 225:1700). Anchored near the + clicked sample dot, points "up-left" via drop shadow. Same data + as the side-panel card; this is the in-map surface companion. + See issue #226 for click-semantics framing. */ + .in-map-card { + position: absolute; + /* Sits above search overlay (1000), results line (1000), color + legend (1000), and Cesium toolbar (z=2). Per Codex review of + #226: any value below 1000 would let the card slide + underneath those surfaces. */ + z-index: 1001; + width: 220px; + background: white; + border: 0.7px solid #d9d9d9; + border-radius: 7px; + padding: 8px; + filter: drop-shadow(-6px 6px 5px rgba(0,0,0,0.3)); + font-family: Inter, system-ui, sans-serif; + font-size: 12px; + line-height: 1.35; + pointer-events: auto; + } + .in-map-card[hidden] { display: none; } + .in-map-card .imc-head { + display: flex; align-items: flex-start; justify-content: space-between; + gap: 6px; margin-bottom: 6px; + } + .in-map-card .imc-title { + font-weight: 700; color: #36c; text-decoration: underline; + font-size: 13px; line-height: 1.25; + word-break: break-word; flex: 1 1 auto; + } + .in-map-card .imc-title:hover { color: #0d47a1; } + .in-map-card .imc-close { + flex: 0 0 auto; background: none; border: none; cursor: pointer; + font-size: 16px; line-height: 1; color: #666; padding: 0 2px; + } + .in-map-card .imc-close:hover { color: #000; } + .in-map-card .imc-body { display: flex; gap: 8px; align-items: flex-start; } + .in-map-card .imc-meta { + flex: 1 1 auto; min-width: 0; + /* Hard wrap: protects against unresolved vocab URIs or other + long strings (no spaces → would otherwise overflow the + 220px card). overflow-wrap handles the no-space case; + word-break is the legacy fallback. */ + overflow-wrap: anywhere; + word-break: break-word; + } + .in-map-card .imc-meta > div { margin-bottom: 2px; } + .in-map-card .imc-meta b { font-weight: 700; } + .in-map-card .imc-coords { color: #555; margin-top: 4px; } + .in-map-card .imc-thumb { + flex: 0 0 auto; width: 56px; height: 56px; + border: 1px solid #d9d9d9; border-radius: 3px; + background: #f5f5f5; + display: flex; align-items: center; justify-content: center; + overflow: hidden; + } + .in-map-card .imc-thumb img { width: 100%; height: 100%; object-fit: cover; } + .in-map-card .imc-thumb-placeholder { + width: 100%; height: 100%; position: relative; + background: linear-gradient(135deg, transparent calc(50% - 0.5px), #bbb calc(50% - 0.5px), #bbb calc(50% + 0.5px), transparent calc(50% + 0.5px)), + linear-gradient(45deg, transparent calc(50% - 0.5px), #bbb calc(50% - 0.5px), #bbb calc(50% + 0.5px), transparent calc(50% + 0.5px)); + } + .in-map-card .imc-source-badge { + display: inline-block; color: white; padding: 1px 6px; + border-radius: 6px; font-size: 10px; font-weight: 700; + margin-bottom: 4px; + } .sample-row { padding: 6px 0; border-bottom: 1px solid #eee; line-height: 1.4; } .sample-row:last-child { border-bottom: none; } .sample-label { font-weight: 600; font-size: 13px; } @@ -395,8 +464,20 @@ format: font-size: 10px; white-space: nowrap; } - .table-link { color: #1565c0; text-decoration: none; } + /* Was an until #226 — kept the visual styling but the element + is now a role="button" span (no href) so click-anywhere-in-row + opens the detail card uniformly. The external source URL lives + inside the card. Keyboard parity via tabindex=0 + Enter/Space + handled in the row-click handler. */ + .table-link { + color: #1565c0; text-decoration: none; + cursor: pointer; background: none; border: 0; padding: 0; + font: inherit; + } .table-link:hover { text-decoration: underline; } + .table-link:focus-visible { + outline: 2px solid #1565c0; outline-offset: 2px; border-radius: 2px; + } .table-pager { display: flex; justify-content: space-between; @@ -490,6 +571,10 @@ Circle size = log(sample count). Color = dominant data source. GEOME Smithsonian + +