typed: stop the subtitle animation before the page is replaced - #626
Open
theman6660 wants to merge 1 commit into
Open
theman6660 wants to merge 1 commit into
theman6660 wants to merge 1 commit into
Conversation
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.
|
@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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #534
Summary
Entering an encrypted post and returning home left two typing cursors on the banner subtitle. Typed.js inserts
.typed-cursoras 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.content:replacehook calls it while the old#subtitleis still in the document.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.jsin headless Chromium:initTyped()twice leaves one cursor.destroyTyped()removes that cursor, and the typing timer does not keep scheduling.Typedinstances without this cleanup produces the two-cursor overlap from the issue screenshot.Build artifacts under
source/js/build/are left for CI, perCONTRIBUTING.md.