Scroll collapsed file into view (#23702)

This commit is contained in:
Jimmy Praet authored and GitHub committed 2023-04-05 07:51:42 +08:00
1 parent 0983b237d5
commit 54197b67f9
3 files changed
+12 -2

No files matched your search

+3
View File
@@ -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.