Skip to content

WEBDEV-8968: Migrate transcript-view into elements - #84

Open
jbuckner wants to merge 2 commits into
WEBDEV-8967-migrate-expandable-search-barfrom
WEBDEV-8968-migrate-transcript-view
Open

WEBDEV-8968: Migrate transcript-view into elements#84
jbuckner wants to merge 2 commits into
WEBDEV-8967-migrate-expandable-search-barfrom
WEBDEV-8968-migrate-transcript-view

Conversation

@jbuckner

@jbuckner jbuckner commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

WEBDEV-8968. Stacked on #83, part of WEBDEV-8962.

Brings transcript-view over as ia-transcript-view, and its child as ia-transcript-entry.

API change: duration-formatter was a whole custom element whose only job was turning a number into mm:ss. It's an exported formatDuration() function now, so timestamps don't each cost an element registration and a shadow root. Same output for every input the old tests covered.

Fixed on the way through:

  • Only one scroll animation runs at a time. Each call started its own requestAnimationFrame loop with no way to cancel it, and playback ticks arrive faster than the one-second animation finishes, so several loops ended up fighting over scrollTop. Progress is clamped to 1 so the final frame lands on target rather than past it, and the animation is cancelled on disconnect — along with the 15-second auto-scroll resume timer, which leaked.
  • An entry whose id is 0 can be found. elementClosestToTime guarded with a falsy check on the id, so a transcript starting at 0 never scrolled to its first entry.
  • Music entries have their own hover colour variable. The hover rule read the active variable, so the two couldn't be themed apart.
  • data-search-result-index is omitted rather than rendered as the literal string "undefined" on non-result entries.
  • formatDuration returns an empty string for NaN/Infinity instead of rendering NaN:NaN.

TranscriptEntryConfig and TranscriptConfig stay classes — displayText and searchResults are real behaviour, not data, which is the line I've drawn against the interfaces in the earlier PRs. The music placeholder goes through msg().

Worth knowing for whoever wires this up: assigning config resets selectedSearchResultIndex and stops the view following playback, and Lit re-commits object bindings on every render — so hold a stable reference rather than building the config inside render(). There's a test pinning that, and a note in the story.

CI shows only deploy-preview here because the PR isn't based on main (WEBDEV-8972). Verified locally: build, full suite 340 passing, eslint and prettier clean, 95% coverage on this component.

Move @internetarchive/transcript-view out of the iaux monorepo as
ia-transcript-view, with its child as ia-transcript-entry. Sixth of seven.

- duration-formatter was a whole custom element that existed to turn a
  number into mm:ss. It's a formatDuration() function now, so every
  timestamp no longer costs an element registration and a shadow root. It
  also returns an empty string for NaN and Infinity rather than rendering
  NaN:NaN, and clamps negatives.
- Only one scroll animation runs at a time. Each call started its own
  requestAnimationFrame loop with no way to stop it, and playback ticks
  arrive faster than a one-second animation finishes, so several loops ended
  up fighting over scrollTop. Progress is clamped to 1 so the last frame
  lands on the target instead of past it, and the animation is cancelled on
  disconnect along with the auto-scroll resume timer, which leaked.
- An entry whose id is 0 can be found. elementClosestToTime guarded with a
  falsy check on the id, so a transcript starting at 0 never scrolled to its
  first entry.
- Music entries have their own hover colour variable. The hover rule read
  the *active* variable, so the two could not be themed apart.
- data-search-result-index is omitted rather than rendered as the string
  "undefined" on entries that aren't search results.

TranscriptEntryConfig and TranscriptConfig stay classes, since displayText
and searchResults are real behaviour rather than data. The music
placeholder goes through msg() so it can be translated.

scrollTimerDelay is a public property, which is how the tests set it
instead of reaching for a private field.

Claude-Session: https://claude.ai/code/session_01U6iNyGicKJywdrWJMTyFin

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 27, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1

🚀 View preview at
https://internetarchive.github.io/elements/pr/pr-84/

Built to branch ghpages at 2026-08-27 20:28 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

…8968-migrate-transcript-view

* WEBDEV-8967-migrate-expandable-search-bar:
  WEBDEV-8972: Run CI on every PR, not just ones based on main (#90)
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.92462% with 30 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.58%. Comparing base (92ddb48) to head (db2a347).

Files with missing lines Patch % Lines
...nts/ia-transcript-view/ia-transcript-view-story.ts 47.82% 20 Missing and 4 partials ⚠️
.../elements/ia-transcript-view/ia-transcript-view.ts 95.20% 0 Missing and 6 partials ⚠️
Additional details and impacted files
@@                              Coverage Diff                              @@
##           WEBDEV-8967-migrate-expandable-search-bar      #84      +/-   ##
=============================================================================
+ Coverage                                      80.80%   81.58%   +0.78%     
=============================================================================
  Files                                             41       46       +5     
  Lines                                           1224     1423     +199     
  Branches                                         276      319      +43     
=============================================================================
+ Hits                                             989     1161     +172     
- Misses                                           154      171      +17     
- Partials                                          81       91      +10     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

2 participants