feat(render-html): Enlarge initial diagram fit on common viewports#164
Merged
Conversation
Reduce the symmetric padding used by computeFit from 40px to 20px so the initial fit-to-screen scale is meaningfully larger on medium and large diagrams. The viewport already accounts for minimap, viewer controls, drawer and heading insets via getAvailableViewport, so a smaller fit padding avoids stacking margin on top of those overlays while keeping the diagram comfortably visible.
Add a viewer-controls button and an "M" keyboard shortcut that toggle the minimap shell's hidden state. The toggle exposes a new runtime.minimap API, emits relune:minimap-toggled, and is persisted in the URL hash via the mh parameter so shared links retain the chosen minimap visibility. Toggling also re-fits the diagram so the freed viewport area is used immediately, addressing the "diagram looks too small" feedback when the minimap overlay is not needed.
The minimap shell reserves ~180px of vertical bottom inset in getAvailableViewport, which left the initial fit scale uncomfortably small on common laptop viewports (e.g. 33% on 14" MacBook for the custom playground fixture). Start the viewer with the minimap hidden; users can reveal it via the toolbar toggle or the `M` shortcut, and the button's title/aria-label flips to "Show minimap (M)" / "Hide minimap (M)" so the interaction is discoverable. Persist visibility via `mv=1` in the hash (replacing the previous `mh=1` since the default flipped).
Keep the toggle button's accessible name stable as "Minimap" so
assistive tech reads the action and pressed state cleanly instead of
mixing them ("Hide minimap, pressed"). The hover title still flips
between Show/Hide so sighted users see the next action. Advertise the
M shortcut via aria-keyshortcuts now that the minimap is hidden by
default and discoverability matters more.
Add a silent option to ViewerMinimapApi.setHidden and use it when
restoring from the hash. Previously the restore emitted
relune:minimap-toggled, which queued a debounced hash write that ran
after restoringFromPopstate had flipped back to false, pushing a
spurious history entry on back/forward navigation.
Code Metrics Report
Details | | main (c9be562) | #164 (48767cb) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 94.4% | 94.4% | +0.0% |
| Files | 100 | 100 | 0 |
| Lines | 36825 | 36842 | +17 |
+ | Covered | 34784 | 34801 | +17 |
+ | Test Execution Time | 1m44s | 1m38s | -6s |Code coverage of files in pull request scope (99.9% → 99.9%)
Reported by octocov |
Schema reviewTip ✅ No risk findings — schema changes look safe to merge. |
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
computeFitpadding from 40 to 20.Mshortcut for revealing the minimap, with accessible labelling and stable popstate behaviour.Changes
aria-pressedfor state and flipping only the hover title between "Show minimap (M)" / "Hide minimap (M)"aria-keyshortcuts="M"{ silent: true }option toViewerMinimapApi.setHiddenso hash restore no longer queues a debouncedpushStateand spuriously grows the back-stack#minimap-shellhidden sogetAvailableViewportreturns the freed bottom inset to the diagrammv=1(replacing the previousmh=1since the default flipped)Mkeyboard shortcut, guarded against modifier keys to avoid clashing with Cmd+MViewerMinimapApi(isHidden/setHidden) through the runtime, emitrelune:minimap-toggled, and persist state in the URL hashcomputeFitpadding from 40 to 20 so the initial scale uses more of the available viewport on common laptop screens