diff --git a/frontend/src/api.ts b/frontend/src/api.ts index 1d20a3b..c405bf4 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -54,6 +54,7 @@ export const API = { async getMessages(channelId: string) { const response = await API.request("GET", `channels/${channelId}/messages`); + console.log(response) const json = await response.json(); return json.messages as IMessage[]; }, diff --git a/frontend/src/ui/list.ts b/frontend/src/ui/list.ts index 6b221e8..81d46a6 100644 --- a/frontend/src/ui/list.ts +++ b/frontend/src/ui/list.ts @@ -44,6 +44,7 @@ export class List extends UINode { if (idx === this.focused) { if (this.focused > 0) this.focused--; this.calculateTabIndex(); + this.children[this.focused].focus() } return this; } diff --git a/frontend/src/views/main.ts b/frontend/src/views/main.ts index d62aa16..ea0b1a6 100644 --- a/frontend/src/views/main.ts +++ b/frontend/src/views/main.ts @@ -231,7 +231,9 @@ export class MainView extends View { itm.onKeyDown((key: string, alt: boolean | undefined, shift: boolean | undefined, ctrl: boolean | undefined) => { if (key === "Delete") { this.removeMessage(message.id); - this.messageInput.focus() + if (this.messageList.children.length === 1) { + this.messageInput.focus() + } } }); return itm;