Skip to content

explorer: in-map detail card + unified click semantics (#226)#228

Merged
rdhyee merged 1 commit into
isamplesorg:mainfrom
rdhyee:inmap-detail-card
May 21, 2026
Merged

explorer: in-map detail card + unified click semantics (#226)#228
rdhyee merged 1 commit into
isamplesorg:mainfrom
rdhyee:inmap-detail-card

Conversation

@rdhyee
Copy link
Copy Markdown
Contributor

@rdhyee rdhyee commented May 21, 2026

Closes #226.

What this adds

In-map floating detail card (Hana Figma 222:456 / card subnode 225:1700) anchored near the clicked sample dot, with viewport-edge collision avoidance. Same data path as the existing side-panel sample card; this is the map-anchored surface companion.

Unified 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 was rendered as <a href={sourceUrl(pid)}> and the row-click handler bailed on anchor targets, so clicking the most-attractive target (the title) opened the external site while clicking anywhere else in the row updated the panel and flew the map. The bold blue underlined element did the least useful thing.

Lazy-load resolves vocab 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.parquet references.

Codex-reviewed iteration

After the initial commit, Codex found 5 issues. 4 are fixed in this PR; #5 spun out to #227 (separate-PR followup so this diff stays scoped).

# Codex finding Status
1 XSS in card HTML construction (innerHTML interpolation of titleText, source name, srcUrl, thumbnail_url) ✅ Fixed: escapeHtml() for all text/attribute interpolations; thumbnail image built via DOM construction with property-based onerror instead of inline-JS attribute
2 Table-row card-vs-detail race (detail query could return before flyTo.complete, populating a still-hidden card) ✅ Fixed: card shows immediately at canvas centre (where the sample lands post-flyTo); flyTo animates underneath
3 Card z-index: 5 could sit underneath search overlay / results / legend (all at 1000) ✅ Fixed: bumped to 1001
4 Table title remained semantically an <a href> (a11y: screen readers announce as link that no longer fires) ✅ Fixed: now a role="button" tabindex="0" span with aria-label; visual styling preserved; Enter/Space keyboard parity added; focus-visible outline
5 Other surfaces (nearby-samples panel, search-results panel) still render <a href> and bail row-clicks on anchor targets #227 (separate PR — design decision needed for the nearby-samples row activation)

Pre-deploy smoke gate

#225 passes locally on this branch: 1 passed in 12.75s.

SMOKE OK — search result: '50+ results for "pottery"'

Gate will run again as part of CI on push-to-main; deploy is fail-closed if it doesn't pass.

What I asked of the reviewer / what changed

The user-visible UX changes worth eyeballing in the deployed build:

  1. Click a map dot → floating card appears near the dot with title (linked to source), source badge, material, sample feature, specimen type, coords, thumbnail (when present). Close (×) button. Title is a link to the source record.
  2. Click anywhere in a samples-table row (including the title) → same card appears at canvas centre; camera flies to the sample underneath the already-visible card. No more "click title → external site" surprise.
  3. Tab onto a row title → outline-focus visible; Enter/Space opens the card.
  4. Clicking on empty map space → card closes (deselect).
  5. Clicking a cluster → card closes (selection cleared).

Files changed

explorer.qmd only. ~349 insertions / 18 deletions in one Quarto file.

Followups

🤖 Generated with Claude Code

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 (isamplesorg#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 <a href={sourceUrl}> 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 <a>. 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 (isamplesorg#225) passes locally: 1 passed in 12.75s.

Followup: isamplesorg#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) <noreply@anthropic.com>
@rdhyee rdhyee merged commit 633d14c into isamplesorg:main May 21, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explorer: unify click semantics — click opens detail card, external link is one-hop-away

1 participant