fix(app): keyboard navigation previous/next message (#15047)
This commit is contained in:
@@ -254,12 +254,13 @@ export default function Page() {
|
||||
const msgs = visibleUserMessages()
|
||||
if (msgs.length === 0) return
|
||||
|
||||
const current = activeMessage()
|
||||
const currentIndex = current ? msgs.findIndex((m) => m.id === current.id) : -1
|
||||
const targetIndex = currentIndex === -1 ? (offset > 0 ? 0 : msgs.length - 1) : currentIndex + offset
|
||||
if (targetIndex < 0 || targetIndex >= msgs.length) return
|
||||
const current = store.messageId
|
||||
const base = current ? msgs.findIndex((m) => m.id === current) : msgs.length
|
||||
const currentIndex = base === -1 ? msgs.length : base
|
||||
const targetIndex = currentIndex + offset
|
||||
if (targetIndex < 0 || targetIndex > msgs.length) return
|
||||
|
||||
if (targetIndex === msgs.length - 1) {
|
||||
if (targetIndex === msgs.length) {
|
||||
resumeScroll()
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user