Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
Focus chat input field when switching to a chat tab
Browse files Browse the repository at this point in the history
  • Loading branch information
elisee committed Jul 7, 2016
1 parent cf885ba commit 62586ab
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/renderer/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,12 @@ export function onActivateTab(tabElt: HTMLLIElement) {
if (serverId != null) paneElt = panesElt.querySelector(`:scope > div[data-server-id="${serverId}"]`) as HTMLDivElement;
else paneElt = panesElt.querySelector(`:scope > *[data-name="${paneName}"]`) as HTMLDivElement;
paneElt.hidden = false;
(paneElt.firstElementChild as HTMLElement).focus();

const firstChild = paneElt.firstElementChild as HTMLElement;
if (firstChild.tagName === "WEBVIEW") firstChild.focus();
else if (paneElt.classList.contains("chat-tab")) {
(paneElt.querySelector(".input textarea") as HTMLTextAreaElement).focus();
}
}

function onCloseTab(tabElement: HTMLLIElement) {
Expand Down

0 comments on commit 62586ab

Please sign in to comment.