longform: fix opening midway instead of at top
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 <noreply@anthropic.com> Tested-by: William Casarin <jb55@jb55.com> Signed-off-by: alltheseas Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
Daniel D’Aquino
parent
93834f8de2
commit
078042546b
@@ -383,7 +383,10 @@ struct ChatroomThreadView: View {
|
|||||||
}
|
}
|
||||||
.onAppear() {
|
.onAppear() {
|
||||||
thread.subscribe()
|
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)
|
// Ensure chrome is visible when view appears (handles interrupted transitions)
|
||||||
if isLongformEvent {
|
if isLongformEvent {
|
||||||
chromeHidden = false
|
chromeHidden = false
|
||||||
|
|||||||
Reference in New Issue
Block a user