Skip to content

typed: stop the subtitle animation before the page is replaced - #626

Open
theman6660 wants to merge 1 commit into
evannotfound:devfrom
theman6660:fix/typed-subtitle-teardown
Open

theman6660 wants to merge 1 commit into
evannotfound:devfrom
theman6660:fix/typed-subtitle-teardown

Conversation

@theman6660

Copy link
Copy Markdown

Fixes #534

Summary

Entering an encrypted post and returning home left two typing cursors on the banner subtitle. Typed.js inserts .typed-cursor as the next sibling of #subtitle, and the previous instance kept its timer after Swup replaced the page. The next visit then constructed another instance on the same subtitle.

  • destroyTyped() stops the timer, removes leftover cursor siblings, and invalidates an in-flight hitokoto request.
  • The Swup content:replace hook calls it while the old #subtitle is still in the document.
  • A later initTyped() still replaces any instance that is already running, including the hitokoto refresh-on-loop case.

Verification

Ran the changed module against source/js/libs/Typed.min.js in headless Chromium:

  • Calling initTyped() twice leaves one cursor.
  • destroyTyped() removes that cursor, and the typing timer does not keep scheduling.
  • Constructing two raw Typed instances without this cleanup produces the two-cursor overlap from the issue screenshot.

Build artifacts under source/js/build/ are left for CI, per CONTRIBUTING.md.

Swup removes #subtitle on navigation, but Typed.js keeps its timer and
inserts the cursor as a sibling. Returning home then starts a second
instance, so the subtitle shows two cursors. Destroy the instance before
the page is replaced, and ignore a hitokoto response that arrives later.
@vercel

vercel Bot commented Sep 22, 2026

Copy link
Copy Markdown

@theman6660 is attempting to deploy a commit to the Evanovation Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

1 participant