Skip to content

Commit dd7404e

Browse files
silverwindGiteaBot
authored andcommitted
Fix sticky header in diff view (go-gitea#23554)
Ressurection of go-gitea#23549. Fix regression go-gitea#23513 (comment) from go-gitea#23271. The previous sticky CSS did assume the content is always 2 rows, but since that PR, it's single-row above 993px width. Adjust the sticky offset to match and add a small tweak that hides content behind the `border-radius`. Single row: <img width="1264" alt="Screenshot 2023-03-17 at 21 33 05" src="https://user-images.githubusercontent.com/115237/226034050-a04b131d-fd3f-45c0-bc72-413738a59825.png"> Double row: <img width="1243" alt="Screenshot 2023-03-17 at 21 32 53" src="https://user-images.githubusercontent.com/115237/226034163-2f1c6aa9-fc72-432f-bc46-9a7119da8677.png">
1 parent 1a97a84 commit dd7404e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

Diff for: web_src/css/repository.css

+10-2
Original file line numberDiff line numberDiff line change
@@ -1611,12 +1611,14 @@
16111611
padding: 7px 0;
16121612
background: var(--color-body);
16131613
line-height: 30px;
1614+
height: 47px; /* match .ui.attached.header.diff-file-header.sticky-2nd-row */
16141615
}
16151616

16161617
@media (max-width: 991px) {
16171618
.repository .diff-detail-box {
16181619
flex-direction: column;
16191620
align-items: flex-start;
1621+
height: 77px; /* match .ui.attached.header.diff-file-header.sticky-2nd-row */
16201622
}
16211623
}
16221624

@@ -1630,7 +1632,7 @@
16301632
position: sticky;
16311633
top: 0;
16321634
z-index: 8;
1633-
border-bottom: 1px solid var(--color-secondary);
1635+
border-bottom: none;
16341636
padding-left: 2px;
16351637
padding-right: 2px;
16361638
margin-left: -1px;
@@ -3318,10 +3320,16 @@ td.blob-excerpt {
33183320

33193321
.ui.attached.header.diff-file-header.sticky-2nd-row {
33203322
position: sticky;
3321-
top: 77px;
3323+
top: 47px; /* match .repository .diff-detail-box */
33223324
z-index: 7;
33233325
}
33243326

3327+
@media (max-width: 991px) {
3328+
.ui.attached.header.diff-file-header.sticky-2nd-row {
3329+
top: 77px; /* match .repository .diff-detail-box */
3330+
}
3331+
}
3332+
33253333
@media (max-width: 480px) {
33263334
.ui.attached.header.diff-file-header.sticky-2nd-row {
33273335
position: static;

0 commit comments

Comments
 (0)