feat: add mobile TOC animation#1326
Open
powerfullz wants to merge 8 commits intoCaiJimmy:masterfrom
Open
Conversation
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.
This pull request refactors and enhances the mobile slide animation logic for both the main menu and the article Table of Contents (TOC). It introduces a shared animation module, improves accessibility and responsiveness, and updates related styles for a smoother user experience, especially on mobile devices.
Shared Slide Animation Core:
slideAnimation.tsmodule that centralizes slide open/close logic, ensuring consistent and accessible animations for both the mobile menu and TOC. The implementation includes reduced-motion support, transition lifecycle handling, and inline style cleanup.Mobile Menu Refactor:
menu.tsto use the new shared slide animation utilities, replacing the legacy slideUp/slideDown code. The menu now respects reduced-motion settings, handles animation state more robustly, and ensures the menu closes cleanly on window resize.Mobile TOC Animation:
mobileToc.tsmodule that applies the shared slide animation logic to the article TOC. This enables smooth expand/collapse behavior for the TOC on mobile, with proper handling of animation state, reduced-motion, and window resizes.main.ts. [1] [2]Accessibility and Style Improvements:
:not(.toc-collapsing)), disable tap highlight, prevent text selection on the TOC title, and use a more consistent transition duration for SVG rotation. [1] [2] [3] [4]output.webm