From 078042546b133736be51bc18968b21197a183f1a Mon Sep 17 00:00:00 2001 From: alltheseas Date: Sat, 3 Jan 2026 15:49:34 -0600 Subject: [PATCH] longform: fix opening midway instead of at top MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The scroll_to_event function defaults to anchor: .bottom, which positions the selected event at the bottom of the viewport. For longform notes, this causes the article to open midway or at the bottom instead of the top where the title is. Changed the initial scroll anchor to .top only for longform articles (kind 30023), preserving the existing .bottom behavior for regular notes which keeps parent context visible in reply threads. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Closes: https://github.com/damus-io/damus/issues/2481 Closes: https://github.com/damus-io/damus/pull/3488 Changelog-Fixed: Longform articles now open at the top instead of midway through Co-Authored-By: Claude Opus 4.5 Tested-by: William Casarin Signed-off-by: alltheseas Signed-off-by: William Casarin --- damus/Features/Chat/ChatroomThreadView.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/damus/Features/Chat/ChatroomThreadView.swift b/damus/Features/Chat/ChatroomThreadView.swift index ccd2d13a..d4fa01fe 100644 --- a/damus/Features/Chat/ChatroomThreadView.swift +++ b/damus/Features/Chat/ChatroomThreadView.swift @@ -383,7 +383,10 @@ struct ChatroomThreadView: View { } .onAppear() { thread.subscribe() - scroll_to_event(scroller: scroller, id: thread.selected_event.id, delay: 0.1, animate: false) + // Use .top anchor for longform articles so they open at the title, + // keep .bottom for regular notes to preserve parent context visibility + let anchor: UnitPoint = thread.selected_event.known_kind == .longform ? .top : .bottom + scroll_to_event(scroller: scroller, id: thread.selected_event.id, delay: 0.1, animate: false, anchor: anchor) // Ensure chrome is visible when view appears (handles interrupted transitions) if isLongformEvent { chromeHidden = false