Skip to content

Commit 604eed9

Browse files
authored
Merge branch 'main' into fix-repo-broken-check
2 parents 6a2cfaf + b5fd3e7 commit 604eed9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

templates/repo/home_sidebar_bottom.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="flex-item">
55
<div class="flex-item-main">
66
<div class="flex-item-title">
7-
<a class="item muted" href="{{.Link}}/releases">
7+
<a class="item muted" href="{{.RepoLink}}/releases">
88
{{ctx.Locale.Tr "repo.releases"}}
99
<span class="ui small label">{{.NumReleases}}</span>
1010
</a>

web_src/js/utils/dom.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@ export function autosize(textarea: HTMLTextAreaElement, {viewportMarginBottom =
161161
function resizeToFit() {
162162
if (isUserResized) return;
163163
if (textarea.offsetWidth <= 0 && textarea.offsetHeight <= 0) return;
164+
const previousMargin = textarea.style.marginBottom;
164165

165166
try {
166167
const {top, bottom} = overflowOffset();
@@ -176,6 +177,9 @@ export function autosize(textarea: HTMLTextAreaElement, {viewportMarginBottom =
176177
const curHeight = parseFloat(computedStyle.height);
177178
const maxHeight = curHeight + bottom - adjustedViewportMarginBottom;
178179

180+
// In Firefox, setting auto height momentarily may cause the page to scroll up
181+
// unexpectedly, prevent this by setting a temporary margin.
182+
textarea.style.marginBottom = `${textarea.clientHeight}px`;
179183
textarea.style.height = 'auto';
180184
let newHeight = textarea.scrollHeight + borderAddOn;
181185

@@ -196,6 +200,12 @@ export function autosize(textarea: HTMLTextAreaElement, {viewportMarginBottom =
196200
textarea.style.height = `${newHeight}px`;
197201
lastStyleHeight = textarea.style.height;
198202
} finally {
203+
// restore previous margin
204+
if (previousMargin) {
205+
textarea.style.marginBottom = previousMargin;
206+
} else {
207+
textarea.style.removeProperty('margin-bottom');
208+
}
199209
// ensure that the textarea is fully scrolled to the end, when the cursor
200210
// is at the end during an input event
201211
if (textarea.selectionStart === textarea.selectionEnd &&

0 commit comments

Comments
 (0)