Commit b15588f3 by michaelpastushkov

fix

parent 12e79c3d
......@@ -202,7 +202,7 @@
z-index: 1100;
/* above composer/footer */
display: none;
/* hidden initially */
/* hard-hidden until armed */
align-items: center;
justify-content: center;
border: 1px solid #ced4da;
......@@ -324,6 +324,9 @@
let firstRequestDone = false;
let controller = null;
// HARD STOP guard: do not show button until conversation starts
let scrollBtnArmed = false;
// --- render helpers ---
function renderMarkdown(targetEl, md) {
const html = marked.parse(md, { breaks: true, gfm: true, headerIds: false });
......@@ -382,8 +385,12 @@
}
function updateScrollButton() {
// Hard stop: never show until armed
if (!scrollBtnArmed) {
scrollDownBtn.style.display = 'none';
return;
}
const needs = isOverflowingAny() && !atBottom();
// hidden initially (no overflow) and whenever you’re at the bottom
scrollDownBtn.style.display = needs ? 'inline-flex' : 'none';
}
......@@ -405,6 +412,9 @@
if (!firstRequestDone) { welcomeLogo?.remove(); firstRequestDone = true; }
// Arm the scroll button the moment a real conversation starts
scrollBtnArmed = true;
const autoStick = atBottom();
const userMsg = document.createElement('div');
......@@ -496,7 +506,7 @@
window.addEventListener('scroll', updateScrollButton, { passive: true });
window.addEventListener('resize', updateScrollButton);
// Observe content changes to recalc button visibility
// Observe content changes to recalc button visibility (only after armed)
const threadObserver = new MutationObserver(() => {
requestAnimationFrame(updateScrollButton);
});
......@@ -507,7 +517,10 @@
try { await fetch('/api/clear', { method: 'GET' }); } catch (_) { }
await loadLocale(CURRENT_LOCALE);
inputText.focus();
updateScrollButton(); // initial -> hidden if no overflow
// Force-hide at startup no matter what
scrollBtnArmed = false;
scrollDownBtn.style.display = 'none';
updateScrollButton();
});
</script>
</body>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment