FN-5757: prevent chat message list from snapping to top

Keep chat scroll position stable when stale top snapshots are captured during mobile message updates.

- Capture scroll anchors from the first visible message instead of always sampling the first DOM node
- Ignore stale or likely-invalid zero-position snapshots before attempting scroll restoration
- Guard bottom anchoring from interrupting user scroll unless explicitly forced and add regression coverage for stale snapshot behavior

Files changed:
 packages/dashboard/app/components/ChatView.css     | 11 +++++-
 packages/dashboard/app/components/ChatView.tsx     | 33 +++++++++++++----
 packages/dashboard/app/components/__tests__/ChatView.scroll-to-top.test.tsx      | 41 ++++++++++++++++++++++
 3 files changed, 78 insertions(+), 7 deletions(-)

Fusion-Task-Id: FN-5757

Fusion-Task-Lineage: 4e4f6843-ba70-40da-8d16-358bdfcc7b09
This commit is contained in:
gsxdsm
2026-05-30 16:48:13 -07:00
parent 0e0b17f3c4
commit eba6a72594
3 changed files with 78 additions and 7 deletions

View File

@@ -642,13 +642,15 @@
/* Messages */
.chat-messages {
flex: 1;
flex: 1 1 auto;
min-height: 0;
overflow-y: auto;
padding: 16px;
display: flex;
flex-direction: column;
gap: 12px;
-webkit-overflow-scrolling: touch;
touch-action: pan-y;
/* Stop iOS rubber-band scroll from propagating to the parent /
document when the user swipes on the edge of the messages list
with the keyboard up. Without this, the bounce escapes the
@@ -1743,6 +1745,13 @@
flex-wrap: nowrap;
}
.chat-messages {
min-height: 0;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
touch-action: pan-y;
}
.chat-thread-header-identity {
flex: 1 1 auto;
min-width: 0;