Add update trigger to scroll-reveal action for dynamic elements#55
Merged
Sparkier merged 2 commits intoJul 16, 2026
Conversation
added 2 commits
July 15, 2026 16:58
Contributor
Author
|
[CI/CD Fix Attempt 1] Fixed the ESLint failure in the The To resolve this, I:
Verified locally that |
Sparkier
deleted the
jules/feat/scroll-reveal-manual-update-js1-aad187b8-d56c-427e-a9cc-b763f1ac38a9
branch
July 16, 2026 08:00
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.
Why This Change is Necessary
Previously, dynamic elements rendered inside conditional template blocks or added post-mount remained permanently hidden. This occurred because our custom
scroll-revealSvelte action only queried and observed child elements during its initial instantiation (mount).To work around this limitation and ensure complete content visibility when exporting or printing the CV page as a PDF, we had a fragile, manual DOM-query workaround in
src/routes/cv/+page.svelte. This workaround directly manipulated CSS visibility classes, bypassing Svelte's reactive paradigm.This PR introduces an explicit
updatehook to the scroll-reveal action, allowing templates to trigger a re-query of the DOM whenever specific page states change. This resolves the hidden-content bug cleanly, retains high performance, and allows us to remove the brittle CV page workaround.Key Decisions & Rationale
MutationObserverimplementations. Instead, therevealaction accepts an explicit parameter object. It only re-evaluates children when Svelte signals a state change via the action'supdatemethod..revealelements with theIntersectionObserverwhile ignoring elements that have already been revealed, preventing double-animation or layout disruptions.reveal.tsand the pages that utilize dynamic rendering (like the CV page), avoiding the need to refactor every single page binding in the codebase.What Was Changed
1. Scroll-Reveal Action (
src/lib/actions/reveal.ts)use:reveal={{ trigger }}).updatelifecycle method. When thetriggerdependency changes, the action re-queries the DOM for target.revealelements.IntersectionObserverwhile ensuring already-visible elements remain unaffected.observer.disconnect()to prevent memory leaks.2. CV Page Refactoring (
src/routes/cv/+page.svelte)container.parentElement?.querySelectorAll('.reveal') ...) used during PDF exports.showLinksstate dependency directly to therevealwrapper:showLinkstoggles (e.g., when returning from the CV PDF export), Svelte automatically signals therevealaction to re-observe newly rendered elements.Verification & Testing
vitestandsvelte-checkto confirm no type regressions or test failures were introduced.