Skip to content

Poster/Talk preview popover with download actions (#840)#1374

Merged
jonfroehlich merged 1 commit into
masterfrom
840-poster-talk-hover-preview
Jun 22, 2026
Merged

Poster/Talk preview popover with download actions (#840)#1374
jonfroehlich merged 1 commit into
masterfrom
840-poster-talk-hover-preview

Conversation

@jonfroehlich

Copy link
Copy Markdown
Member

Closes #840.

What

Hovering or clicking a publication's Poster / Talk link now opens a Cite-style card showing the artifact thumbnail plus download actions — PDF, the raw file (PPTX/Keynote/…), and the editable Source link (external_slides_url) — each with its file size. Clicking the thumbnail opens the PDF.

Interaction & accessibility

  • Opens on hover (mouse), and on click / Enter / tap (which pins it open). Mirrors the existing Cite popover.
  • On click/keyboard open, focus moves into the card and Tab is trapped within it; Escape and outside-click close it and restore focus to the trigger.
  • Touch: a tap opens the card (no hover), so touch users reach every action.
  • Trigger keeps href to the PDF, so it still works with JS disabled (progressive enhancement).
  • Degrades to the plain direct-to-PDF link when the artifact has no thumbnail.

Robustness fix

The card shows each file's size, read from storage at render time via FileField.size — which raises FileNotFoundError when a file is missing on disk. Because the size renders for every entry on a listing, a single missing file 500'd the entire /publications/ page. New safe pdf_file_size / raw_file_size properties on Artifact make a missing file degrade to "no size shown" instead. (Surfacing/fixing the underlying missing files is the existing Media / file integrity Data Health check's job.)

Files

  • snippets/artifact_preview_link.html (new) — reusable trigger + inert <template> card; the image lazy-loads only when the card opens.
  • static/website/js/thumbnailPreview.js (new) — self-contained, event-delegated popover (works with the member page's AJAX "load more" with no re-init).
  • static/website/css/publications.css — card/action styling; reuses Bootstrap's .popover.
  • models/artifact.py — safe file-size properties.
  • display_pub_snippet.html + the 5 pages that render it.

Tests

website/tests/test_thumbnail_preview.py (8 tests): card markup, raw-file & Source actions, plain-link fallback, both layouts, and the missing-file degrade-not-crash path. Full suite green (the one unrelated test_page_metadata red is a stale assertion from 7e497aa, fixed separately).

Before merging

  • Before/after screenshots (per CONTRIBUTING — UI change)
  • Pa11y run on a publications page

🤖 Generated with Claude Code

…#840)

Hovering or clicking a publication's "Poster"/"Talk" link now opens a
Cite-style card showing the artifact thumbnail plus download actions
(PDF, the raw file e.g. PPTX, and the editable Source link), each with
file size. The card opens on hover (mouse) and on click/Enter/tap, moves
focus in and traps Tab while open, and closes on Escape/outside-click, so
it works for mouse, keyboard, and touch alike. It degrades to the plain
direct-to-PDF link when the artifact has no thumbnail.

Also adds safe pdf_file_size/raw_file_size properties on Artifact: the
size is read from storage at render time, which raises FileNotFoundError
when a file is missing on disk. The card renders that size for every
entry on a listing, so a single missing file used to 500 the whole
/publications/ page; it now degrades to "no size shown" instead.

- snippets/artifact_preview_link.html: reusable trigger + inert <template> card
- thumbnailPreview.js: interactive popover (hover + click-to-pin, focus mgmt)
- publications.css: card / action-row styling (reuses Bootstrap .popover)
- wired the script into the 5 pages that render the publication snippet
- tests: website/tests/test_thumbnail_preview.py

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@jonfroehlich jonfroehlich merged commit 6e2828d into master Jun 22, 2026
2 of 3 checks passed
@jonfroehlich jonfroehlich deleted the 840-poster-talk-hover-preview branch June 22, 2026 20:35
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.

Now that we have Poster support for pubs, add hover pop-up with thumbnail?

1 participant