aboutsummaryrefslogtreecommitdiffstats
path: root/web_src/js
diff options
context:
space:
mode:
authorJimmy Praet <jimmy.praet@ksz-bcss.fgov.be>2023-04-05 01:51:42 +0200
committerGitHub <noreply@github.com>2023-04-05 07:51:42 +0800
commit54197b67f988bd8e425c542934dfa2517d1152f3 (patch)
treec33aa39316e946284498463e39a054615a00b9a5 /web_src/js
parent0983b237d50c8648f96f42e776c4529072e7eca9 (diff)
downloadgitea-54197b67f988bd8e425c542934dfa2517d1152f3.tar.gz
gitea-54197b67f988bd8e425c542934dfa2517d1152f3.zip
Scroll collapsed file into view (#23702)
Diffstat (limited to 'web_src/js')
-rw-r--r--web_src/js/features/file-fold.js3
1 files changed, 3 insertions, 0 deletions
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.