wf_akkoma-fe/patches/pr416_06_fix-conversation-collapse-focus.patch

57 lines
1.9 KiB
Diff
Raw Normal View History

2024-10-03 17:09:28 +00:00
From c6de61e081381eaceb9b8b025f86a9fe0fbf3edc Mon Sep 17 00:00:00 2001
From: novenary <novenary@kwak.zip>
Date: Wed, 18 Sep 2024 01:06:26 +0300
Subject: [PATCH] conversation: scrollIntoView when collapsed
This helps find the original context when collapsing a thread on the
timeline.
---
src/components/conversation/conversation.js | 11 ++++++++---
src/components/conversation/conversation.vue | 3 +++
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/src/components/conversation/conversation.js b/src/components/conversation/conversation.js
index 68b90c72..c1e79072 100644
--- a/src/components/conversation/conversation.js
+++ b/src/components/conversation/conversation.js
@@ -267,11 +267,11 @@ const conversation = {
},
replies () {
let i = 1
-
+
return reduce(this.conversation, (result, { id, in_reply_to_status_id }) => {
-
+
const irid = in_reply_to_status_id
-
+
if (irid) {
result[irid] = result[irid] || []
result[irid].push({
@@ -414,6 +414,11 @@ const conversation = {
},
toggleExpanded () {
this.expanded = !this.expanded
+ this.$nextTick(() => {
+ if (!this.expanded) {
+ this.$el.scrollIntoView({ block: 'nearest' })
+ }
+ })
},
getConversationId (statusId) {
const status = this.$store.state.statuses.allStatusesObject[statusId]
diff --git a/src/components/conversation/conversation.vue b/src/components/conversation/conversation.vue
index 61f1358a..934dd7ee 100644
--- a/src/components/conversation/conversation.vue
+++ b/src/components/conversation/conversation.vue
@@ -278,5 +278,8 @@
&.-expanded.status-fadein {
margin: calc(var(--status-margin, $status-margin) / 2);
}
+
+ /* HACK: this value was picked arbitrarily and this is likely not even the right place */
+ scroll-margin-block-start: calc(var(--navbar-height) * 2);
}
</style>