From 1b2606a192db76beead6e5f1f177efd1dfc19239 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 17 Mar 2023 21:29:29 +0100 Subject: [PATCH 1/4] Fix sticky header in diff view --- web_src/css/repository.css | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/web_src/css/repository.css b/web_src/css/repository.css index d2040ec0ac56e..7d4e7db49f792 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -1630,7 +1630,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; @@ -3318,8 +3318,15 @@ td.blob-excerpt { .ui.attached.header.diff-file-header.sticky-2nd-row { position: sticky; - top: 77px; + top: 46.5px; z-index: 7; + box-shadow: 0 -1px 0 1px var(--color-body); /* hide sub-pixel gap on top */ +} + +@media (max-width: 991px) { + .ui.attached.header.diff-file-header.sticky-2nd-row { + top: 76.5px; + } } @media (max-width: 480px) { From 4fd5feb517c3af2c9d29f5e683f1a1b175157f0b Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 17 Mar 2023 22:10:44 +0100 Subject: [PATCH 2/4] use fixed height on upper row and match offset to it --- web_src/css/repository.css | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 7d4e7db49f792..29e54dd53af48 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -1635,6 +1635,13 @@ padding-right: 2px; margin-left: -1px; margin-right: -1px; + height: 47px; /* match .ui.attached.header.diff-file-header.sticky-2nd-row */ +} + +@media (max-width: 991px) { + .repository .diff-detail-box.sticky { + height: 77px; /* match .ui.attached.header.diff-file-header.sticky-2nd-row */ + } } .repository .diff-detail-box > div::after { @@ -3318,14 +3325,14 @@ td.blob-excerpt { .ui.attached.header.diff-file-header.sticky-2nd-row { position: sticky; - top: 46.5px; + top: 47px; /* match .repository .diff-detail-box.sticky */ z-index: 7; - box-shadow: 0 -1px 0 1px var(--color-body); /* hide sub-pixel gap on top */ + box-shadow: 0 -1px 0 1px var(--color-body); /* hide gap behind border-radius */ } @media (max-width: 991px) { .ui.attached.header.diff-file-header.sticky-2nd-row { - top: 76.5px; + top: 77px; /* match .repository .diff-detail-box.sticky */ } } From 36a518842aeb7241d66437ed1d0a3c987c809e4c Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 17 Mar 2023 23:23:42 +0100 Subject: [PATCH 3/4] set height on non-sticky for smooth transition to sticky --- web_src/css/repository.css | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/web_src/css/repository.css b/web_src/css/repository.css index 29e54dd53af48..a77299ef2be1f 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -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 */ } } @@ -1635,13 +1637,6 @@ padding-right: 2px; margin-left: -1px; margin-right: -1px; - height: 47px; /* match .ui.attached.header.diff-file-header.sticky-2nd-row */ -} - -@media (max-width: 991px) { - .repository .diff-detail-box.sticky { - height: 77px; /* match .ui.attached.header.diff-file-header.sticky-2nd-row */ - } } .repository .diff-detail-box > div::after { @@ -3325,14 +3320,14 @@ td.blob-excerpt { .ui.attached.header.diff-file-header.sticky-2nd-row { position: sticky; - top: 47px; /* match .repository .diff-detail-box.sticky */ + top: 47px; /* match .repository .diff-detail-box */ z-index: 7; box-shadow: 0 -1px 0 1px var(--color-body); /* hide gap behind border-radius */ } @media (max-width: 991px) { .ui.attached.header.diff-file-header.sticky-2nd-row { - top: 77px; /* match .repository .diff-detail-box.sticky */ + top: 77px; /* match .repository .diff-detail-box */ } } From c0f3b334fd4552a31ea4db849897daf64210ca67 Mon Sep 17 00:00:00 2001 From: silverwind Date: Sat, 18 Mar 2023 00:42:29 +0100 Subject: [PATCH 4/4] remove fake box-shadow --- web_src/css/repository.css | 1 - 1 file changed, 1 deletion(-) diff --git a/web_src/css/repository.css b/web_src/css/repository.css index a77299ef2be1f..08b7fc490e3e8 100644 --- a/web_src/css/repository.css +++ b/web_src/css/repository.css @@ -3322,7 +3322,6 @@ td.blob-excerpt { position: sticky; top: 47px; /* match .repository .diff-detail-box */ z-index: 7; - box-shadow: 0 -1px 0 1px var(--color-body); /* hide gap behind border-radius */ } @media (max-width: 991px) {