From 11cf7428eb9a226fa43454f16c08344c3135205e Mon Sep 17 00:00:00 2001 From: fen Date: Thu, 17 Sep 2026 14:47:34 -0500 Subject: [PATCH] #260: pin button width during copy feedback so neighbors never jump --- internal/web/static/new.js | 5 ++++- internal/web/static/paste.js | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/internal/web/static/new.js b/internal/web/static/new.js index fb1d1a1..df2c191 100644 --- a/internal/web/static/new.js +++ b/internal/web/static/new.js @@ -199,8 +199,11 @@ function finishCreate(data) { try { navigator.clipboard.writeText(url); copyBtn.classList.add('ok'); // in-place success feedback (#53) + // #260: pin the pre-swap width so the wider/narrower glyph never + // shifts neighbouring elements; release it when the label restores. + copyBtn.style.minWidth = Math.ceil(copyBtn.getBoundingClientRect().width) + 'px'; copyBtn.textContent = '✓'; - setTimeout(() => { copyBtn.classList.remove('ok'); copyBtn.textContent = '⧉'; }, 2000); + setTimeout(() => { copyBtn.classList.remove('ok'); copyBtn.textContent = '⧉'; copyBtn.style.minWidth = ''; }, 2000); } catch(e) { toast('Copy failed', 'error'); } }); // token carried via sessionStorage, never in the URL (#143) diff --git a/internal/web/static/paste.js b/internal/web/static/paste.js index a32b5e3..365f986 100644 --- a/internal/web/static/paste.js +++ b/internal/web/static/paste.js @@ -19,6 +19,12 @@ function toggleStats() { function copyFeedback(btn) { if (!btn) return; if (!btn.dataset.label) btn.dataset.label = btn.textContent; // remember the original label (Copy/Link) + // #260: keep the button width static during the feedback so surrounding + // elements never jump. Pin the pre-swap width, release it on restore. + if (!btn.dataset.pinned) { + btn.style.minWidth = Math.ceil(btn.getBoundingClientRect().width) + 'px'; + btn.dataset.pinned = '1'; + } btn.classList.add('ok'); btn.textContent = '✓'; clearTimeout(btn._okh);