From 43b3b5a34b164bda15c178cd0b39a5d073a2d5a9 Mon Sep 17 00:00:00 2001 From: Volpeon Date: Wed, 3 Jan 2024 13:52:46 +0100 Subject: [PATCH] Ported Firefish's note focus behavior --- packages/frontend/src/components/SkNote.vue | 12 +++- .../src/components/SkNoteDetailed.vue | 58 +++++++++++++++++-- 2 files changed, 65 insertions(+), 5 deletions(-) diff --git a/packages/frontend/src/components/SkNote.vue b/packages/frontend/src/components/SkNote.vue index fdf11c4f56..b5b23386e7 100644 --- a/packages/frontend/src/components/SkNote.vue +++ b/packages/frontend/src/components/SkNote.vue @@ -776,6 +776,10 @@ function focusAfter() { focusNext(el.value); } +function scrollIntoView() { + el.value.scrollIntoView(); +} + function readPromo() { os.api('promo/read', { noteId: appearNote.value.id, @@ -790,6 +794,12 @@ function emitUpdReaction(emoji: string, delta: number) { emit('reaction', emoji); } } + +defineExpose({ + focus, + blur, + scrollIntoView, +});