aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-28 22:48:26 -0700
committerAdam Soltys <[email protected]>2026-09-28 22:48:26 -0700
commit06df23884d69bb2f46a6deeb9b05722d5ba45b53 (patch)
tree77b8924360a3ed3c40e7bd919818ac512964d648 /src
parent5676ffff812e2e1c3459d52128883b7494d5ebff (diff)
downloadcoinosv3-06df23884d69bb2f46a6deeb9b05722d5ba45b53.tar.gz
coinosv3-06df23884d69bb2f46a6deeb9b05722d5ba45b53.zip
A face tapped in the feed opens that person's profile at its top; Back returns to the same place in the feed.
The profile kept the feed's scroll offset, so the reader landed deep in the person's posts — which read as a thread opening. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Du1qT1wbkYwYK6zkGH79Rp
Diffstat (limited to 'src')
-rw-r--r--src/features/messages.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/features/messages.js b/src/features/messages.js
index 701b131..dd31f46 100644
--- a/src/features/messages.js
+++ b/src/features/messages.js
@@ -3021,7 +3021,20 @@ export function messagesFeature(ctx) {
}
}
+ // A profile opens at its top: keeping the feed's scroll offset landed the
+ // reader deep in that person's posts, which read as a thread. Back (a
+ // popstate) puts them where they were on the page they left.
+ const profReturn = []; // [{ pk, y }] per profile opened, newest last
+ window.addEventListener('popstate', () => {
+ const top = profReturn[profReturn.length - 1];
+ if (!top || ui.profilePk === top.pk) return;
+ profReturn.pop();
+ requestAnimationFrame(() => { try { window.scrollTo(0, top.y); } catch {} });
+ });
function openProfile(pk) {
+ let y = 0; try { y = window.scrollY || 0; } catch {}
+ if (ui.profilePk !== pk) profReturn.push({ pk, y });
+ if (profReturn.length > 20) profReturn.shift();
ui.profilePk = pk;
// Opened from inside a thread (an author's avatar/name), the profile
// stacks ON TOP of it — back returns to the conversation. The screen
@@ -3030,6 +3043,7 @@ export function messagesFeature(ctx) {
ui.profOverThread = !!ui.noteThread;
ui.profEdit = null; ui.profEditFilled = false; ui.logoutConfirm = null; ui.profCompose = null;
render();
+ try { window.scrollTo(0, 0); } catch {}
fetchFullProfile(pk);
notesFor(pk);
}