Skip to content

Commit 8e48ca1

Browse files
author
Michael Hobl
committed
fix(layout): viewport hard-bound to 100vh + DOM-level scrollbar dedup — Page root switches from min-height:100vh to height:100vh + overflow:hidden so no child can ever push the document past the viewport (the old 'slightly too tall' was the flex floor + cumulative gap pushing past min-height). main is flex:1 0; min-height:0; overflow:hidden so the editor card shrinks under tight viewports instead of forcing the page to grow. Scrollbar dedup: Monaco's updateOptions() on the inner editors gets re-asserted (so the original-side scrollbar kept reappearing) — drop the JS approach and hide the original pane's .scrollbar.vertical + .decorationsOverviewRuler via raw global CSS instead. Edit pill on the right pane moved from right:16px to right:36px so it clears the 8px scrollbar and the ~14px overview ruler without overlapping. Left-pane pill shifted hair to right:calc(50%+14px) to match
1 parent 7077a96 commit 8e48ca1

2 files changed

Lines changed: 34 additions & 16 deletions

File tree

pages/diff.vue

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,23 @@ export default Vue.extend({
416416
height: 100%;
417417
}
418418
419+
/* Scrollbar dedup, DOM-level. Monaco's diff editor renders two
420+
* inner editors (.editor.original on the left, .editor.modified
421+
* on the right), each with its own .monaco-scrollable-element
422+
* scrollbar. updateOptions() on the inner editors is unreliable
423+
* for hiding scrollbars (Monaco re-asserts its defaults), so we
424+
* collapse the left side's scrollbar with raw CSS instead. The
425+
* right-side scrollbar stays as the single canonical scroll
426+
* affordance — Monaco's intra-diff sync moves both panes
427+
* together. (Block is non-scoped so it reaches Monaco's
428+
* externally-rendered DOM.) */
429+
.monaco-diff-editor .editor.original .monaco-scrollable-element > .scrollbar.vertical {
430+
display: none !important;
431+
}
432+
.monaco-diff-editor .editor.original .decorationsOverviewRuler {
433+
display: none !important;
434+
}
435+
419436
/* Per-pane edit pill. Two of them: left pill anchors to the right
420437
* edge of the original (left) half of the diff, right pill anchors
421438
* to the right edge of the modified (right) half. Both navigate
@@ -460,16 +477,14 @@ export default Vue.extend({
460477
transform: scale(0.96);
461478
}
462479
.noden-pane-edit-left {
463-
/* Sits at the right edge of the original (left) half. Monaco's
464-
* diff editor splits the viewport ~50/50 in side-by-side mode;
465-
* the original pane includes the central gutter so we position
466-
* a hair to the left of the 50% mark to avoid clipping. */
467-
right: calc(50% + 12px);
480+
/* Sits at the right edge of the original (left) half. */
481+
right: calc(50% + 14px);
468482
}
469483
.noden-pane-edit-right {
470-
/* Far right of the modified (right) half, just inside the slim
471-
* 8px scrollbar. */
472-
right: 16px;
484+
/* Far right of the modified (right) half, clearing the 8px
485+
* scrollbar AND the overview ruler (~14px) so the pill never
486+
* sits behind either. */
487+
right: 36px;
473488
}
474489
.dark .noden-pane-edit {
475490
background: rgba(31, 41, 55, 0.85);

styles/global.scss

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,27 +186,30 @@ a:hover {
186186
color: #93c5fd;
187187
}
188188

189+
/* Hard-bound the page to exactly 100vh and hide overflow so no
190+
* child can ever push the document taller than the viewport.
191+
* The flex cascade beneath this lives in that fixed bucket and
192+
* shrinks editors to fit when chrome is tall. */
189193
.page-root {
190-
@apply flow-root w-full;
191-
min-height: 100vh;
194+
@apply w-full;
195+
height: 100vh;
196+
overflow: hidden;
192197
}
193198

194-
/* Tall layout: navbar at the top, footer at the bottom, the routed
195-
* page content claims everything between. main is a flex-column so
196-
* its child .noden-page (and that page's flex children) can cascade
197-
* `flex: 1` down to the editors and let them fill the viewport. */
198199
.page-contents {
199200
display: flex;
200201
flex-direction: column;
201-
min-height: 100vh;
202+
height: 100%;
202203
width: 100%;
204+
overflow: hidden;
203205
}
204206

205207
main {
206208
display: flex;
207209
flex-direction: column;
208-
flex: 1 1 auto;
210+
flex: 1 1 0;
209211
min-height: 0;
212+
overflow: hidden;
210213
@apply xl:container;
211214
margin-top: 2rem;
212215
}

0 commit comments

Comments
 (0)