aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web_src/css/repository.css7
-rw-r--r--web_src/css/review.css4
-rw-r--r--web_src/js/features/file-fold.js3
3 files changed, 12 insertions, 2 deletions
diff --git a/web_src/css/repository.css b/web_src/css/repository.css
index 90faf3cf66..a802222394 100644
--- a/web_src/css/repository.css
+++ b/web_src/css/repository.css
@@ -1867,6 +1867,13 @@
.diff-file-box {
border: 1px solid transparent;
border-radius: var(--border-radius);
+ scroll-margin-top: 47px; /* match .repository .diff-detail-box */
+}
+
+@media (max-width: 991px) {
+ .diff-file-box {
+ scroll-margin-top: 77px; /* match .repository .diff-detail-box */
+ }
}
/* TODO: this can potentially be made "global" by removing the class prefix */
diff --git a/web_src/css/review.css b/web_src/css/review.css
index 07f9a9d2ad..c00a536491 100644
--- a/web_src/css/review.css
+++ b/web_src/css/review.css
@@ -246,12 +246,12 @@ a.blob-excerpt:hover {
display: none;
}
-.pull.files.diff [id] {
+.pull.files.diff .comment {
scroll-margin-top: 99px;
}
@media (max-width: 991px) {
- .pull.files.diff [id] {
+ .pull.files.diff .comment {
scroll-margin-top: 130px;
}
}
diff --git a/web_src/js/features/file-fold.js b/web_src/js/features/file-fold.js
index 0d5be7cf60..8321b9b19e 100644
--- a/web_src/js/features/file-fold.js
+++ b/web_src/js/features/file-fold.js
@@ -8,6 +8,9 @@ import {svg} from '../svg.js';
export function setFileFolding(fileContentBox, foldArrow, newFold) {
foldArrow.innerHTML = svg(`octicon-chevron-${newFold ? 'right' : 'down'}`, 18);
fileContentBox.setAttribute('data-folded', newFold);
+ if (newFold && fileContentBox.getBoundingClientRect().top < 0) {
+ fileContentBox.scrollIntoView();
+ }
}
// Like `setFileFolding`, except that it automatically inverts the current file folding state.