Skip to content

Commit dd338bd

Browse files
Fix issues with z-indexes and elements scrolling out of view []
1 parent 5f92b92 commit dd338bd

3 files changed

Lines changed: 41 additions & 1 deletion

File tree

‎dev_tools/services/acknowledg/client/src/DiffLine.vue‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,26 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
5858
.diff-row {
5959
display: flex;
6060
}
61+
/* Stays in view on horizontal scroll (see NumberedSource.vue). */
6162
.gutter {
63+
position: sticky;
64+
left: 0;
65+
z-index: 1;
66+
background-color: white;
6267
flex: none;
6368
width: 22px;
69+
/* See --content-inset in TestReviewView.vue. */
70+
padding-left: var(--content-inset, 0);
6471
display: flex;
6572
user-select: none;
6673
-webkit-user-select: none;
6774
}
6875
.marker-slot {
6976
margin-left: 2px;
7077
}
78+
@media (prefers-color-scheme: dark) {
79+
.gutter {
80+
background-color: #181A1B;
81+
}
82+
}
7183
</style>

‎dev_tools/services/acknowledg/client/src/NumberedSource.vue‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,20 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
100100
line-height: var(--line-height);
101101
white-space: pre;
102102
}
103+
/* The gutter stays in view when the text is scrolled horizontally; it
104+
needs an opaque background for the text to pass beneath it. It is
105+
stretched to the text's height since a markers-only gutter (raw
106+
output) has no in-flow content to give it one. */
103107
.gutter {
108+
align-self: stretch;
109+
position: sticky;
110+
left: 0;
111+
z-index: 1;
112+
background-color: white;
104113
display: flex;
105114
flex: none;
115+
/* See --content-inset in TestReviewView.vue. */
116+
padding-left: var(--content-inset, 0);
106117
padding-right: 10px;
107118
user-select: none;
108119
-webkit-user-select: none;
@@ -122,6 +133,10 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
122133
left: 2px;
123134
height: var(--line-height);
124135
}
136+
.code:first-child {
137+
/* See --content-inset in TestReviewView.vue. */
138+
padding-left: var(--content-inset, 0);
139+
}
125140
.code {
126141
position: relative;
127142
flex: 1 0 auto;
@@ -134,4 +149,9 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
134149
background-color: rgba(255, 190, 0, 0.25);
135150
pointer-events: none;
136151
}
152+
@media (prefers-color-scheme: dark) {
153+
.gutter {
154+
background-color: #181A1B;
155+
}
156+
}
137157
</style>

‎dev_tools/services/acknowledg/client/src/TestReviewView.vue‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,14 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
663663
<div v-if="displayedOutput === null" class="loader-container">
664664
<loading-spinner />
665665
</div>
666+
<!-- The gutters of NumberedSource and DiffLine stick to the left edge
667+
on horizontal scroll. This container's left padding would scroll
668+
out from under them, shifting them left, so it is passed down as
669+
--content-inset instead: the gutters (or, without a gutter, the
670+
text) apply it as their own left padding. -->
666671
<div v-if="displayedOutput !== null" class="cell-content"
667-
style="overflow: visible; display: grid;">
672+
style="overflow: visible; display: grid;
673+
padding-left: 0; --content-inset: 5px;">
668674
<template v-if="outputViewModeTarget === 'test.src.show-diff' ||
669675
outputViewModeTarget === 'test.src.show-diff-curr'">
670676
<diff-line v-for="(lineText, index) in displayedOutput.split('\n')"
@@ -771,6 +777,8 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
771777
position: sticky;
772778
top: 0px;
773779
left: 0px;
780+
/* Above the content's sticky gutters and positioned highlights. */
781+
z-index: 2;
774782
padding-top: 10px;
775783
padding-bottom: 10px;
776784
}

0 commit comments

Comments
 (0)