feat: animation polish — view-transitions, sidebar collapse animation, reduced-motion guard, copy-icon bounce - #17
Merged
Merged
Conversation
…eviewFrame for improved user interaction
…eme.css for enhanced user experience
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.
Summary
Adds the animation-polish layer the roadmap called for in Phase 2. Pure CSS + progressive enhancement — no Motion One dependency, no JS interop for animation, no external CDN. Every animation is guarded by a global
prefers-reduced-motionrule so accessibility isn't optional.What's new
Global (
src/ShellDocs.Components/wwwroot/shelldocs-theme.css)View-transitions API — cross-fade on route change.
Browser-native cross-fade whenever Blazor enhanced navigation swaps the DOM. Chromium supports today; other engines silently no-op the pseudo rules. Zero JS.
Global
prefers-reduced-motionguard.Kept at
0.01ms(not0) so JStransitionendhandlers still fire — dropping to true zero silently breaks any code that awaits them. Disablesscroll-behavior: smoothand view-transitions too.Sidebar section collapse (
Chrome/DocsSidebarNode.razor+Chrome/DocsSidebar.razor.css)Toggleable sections now animate their content in/out via the
grid-template-rows: 0fr → 1frtrick — natural-height animation without a fixed max-height, no JS.Refactor: toggleable sections always mount a
.sidebar-section-shellwrapper regardless of open state; before this branch, the whole<div class="sidebar-section-items">was conditionally rendered via@if (_isOpen), which made CSS transitions impossible because the element didn't exist when closed.Non-toggleable sections (root level, always open) render directly with no wrapper — no overhead where the animation isn't needed. Chevron rotation already existed (200ms
transformtransition, matched to the collapse duration).Copy-button success morph (
Content/PreviewFrame.razor.css,Content/ComponentPreview.razor.css)Both copy buttons already toggled between two SVG icons (copy → checkmark) on
.copied. The transition was a snap. Now:Elastic-out easing gives a subtle bounce on success — 150ms in, coasts back over the 1.4s hold, snaps to base when the state flips off.
What was already animated (not touched)
All of the above now also inherit
prefers-reduced-motioncollapse via the global guard — previously they'd have fired even with the OS preference set.Test plan
dotnet build shelldocs.slnx— clean, 0 warnings, 0 errorsdotnet test shelldocs.slnx— 129 / 129 passing (no new tests; CSS-only + one Razor structural refactor, covered by manual smoke)_content/ShellDocs.Components/shelldocs-theme.csscontains@view-transition,prefers-reduced-motion, andview-transition-oldblocks.sidebar-section-shellwrapper — visually confirmed the grid-rows transition on clickFiles touched
src/ShellDocs.Components/wwwroot/shelldocs-theme.css—@view-transition,prefers-reduced-motionguardsrc/ShellDocs.Components/Chrome/DocsSidebarNode.razor— always-mount shell wrapper for toggleable sectionssrc/ShellDocs.Components/Chrome/DocsSidebar.razor.css—.sidebar-section-shellgrid-rows transitionsrc/ShellDocs.Components/Content/PreviewFrame.razor.css— copy-icon bouncesrc/ShellDocs.Components/Content/ComponentPreview.razor.css— copy-icon bounce (same pattern)