fix(website): keep diagram top reachable when zoomed#46
Merged
Conversation
- replace flex `center` alignment with `safe center` on zoom modal content - prevents large mermaid diagrams from being clipped above the scroll origin 🐛 - Generated by Copilot
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
Fixes a UX bug in the Docusaurus docs site where, after clicking a Mermaid diagram to zoom in, the top of large diagrams is cropped and unreachable — the user can scroll down but cannot scroll back up to the title row.
Repro
Screenshot of the bug (top labels of the diagram are cut off):
Root cause
.mermaid-zoom-contentinwebsite/src/css/custom.cssis a flex container with:When the SVG is larger than the flex container, plain
centeralignment shifts the item's start edge past the scroll container's origin (negative offset). The browser cannot scroll into negative space, so the top/left of the overflowing content is permanently inaccessible. This is a well-known CSS flexbox + overflow gotcha.Fix
Use the CSS
safealignment keyword, which falls back toflex-startwhen the item overflows but still centers when it fits:Browser support: Chrome 115+, Firefox 115+, Safari 16.4+ (covers all currently supported targets for the docs site).
Files changed
website/src/css/custom.css—.mermaid-zoom-contentblockTest plan
cc @dawright22