Skip to content

Commit

Permalink
Fix sticky header in diff view (#23554) (#23568)
Browse files Browse the repository at this point in the history
Backport #23554 by @silverwind

Ressurection of #23549.

Fix regression
#23513 (comment)
from #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">

Co-authored-by: silverwind <me@silverwind.io>
  • Loading branch information
GiteaBot and silverwind authored Mar 19, 2023
1 parent 1a97a84 commit f5a98b0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions web_src/css/repository.css
Original file line number Diff line number Diff line change
Expand Up @@ -1611,12 +1611,14 @@
padding: 7px 0;
background: var(--color-body);
line-height: 30px;
height: 47px; /* match .ui.attached.header.diff-file-header.sticky-2nd-row */
}

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

Expand All @@ -1630,7 +1632,7 @@
position: sticky;
top: 0;
z-index: 8;
border-bottom: 1px solid var(--color-secondary);
border-bottom: none;
padding-left: 2px;
padding-right: 2px;
margin-left: -1px;
Expand Down Expand Up @@ -3318,10 +3320,16 @@ td.blob-excerpt {

.ui.attached.header.diff-file-header.sticky-2nd-row {
position: sticky;
top: 77px;
top: 47px; /* match .repository .diff-detail-box */
z-index: 7;
}

@media (max-width: 991px) {
.ui.attached.header.diff-file-header.sticky-2nd-row {
top: 77px; /* match .repository .diff-detail-box */
}
}

@media (max-width: 480px) {
.ui.attached.header.diff-file-header.sticky-2nd-row {
position: static;
Expand Down

0 comments on commit f5a98b0

Please sign in to comment.