diff options
| author | Thomas Linford <tlinford@users.noreply.github.com> | 2025-07-31 14:34:26 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-31 14:34:26 +0200 |
| commit | ae8981f7a009a918f3b8ff824e5e4d0dff0545f7 (patch) | |
| tree | 7da8efceb380b92ea3f119ea3f7c44e09850c955 | |
| parent | fix(web): allow pasting with cmd-v (#4321) (diff) | |
| download | sl0ppij-ae8981f7a009a918f3b8ff824e5e4d0dff0545f7.tar.gz sl0ppij-ae8981f7a009a918f3b8ff824e5e4d0dff0545f7.tar.xz sl0ppij-ae8981f7a009a918f3b8ff824e5e4d0dff0545f7.zip | |
fix(web): focus terminal on init (#4325)
Always focus the terminal during init instead of on a mouse event.
| -rw-r--r-- | zellij-client/assets/input.js | 1 | ||||
| -rw-r--r-- | zellij-client/assets/terminal.js | 8 |
2 files changed, 6 insertions, 3 deletions
diff --git a/zellij-client/assets/input.js b/zellij-client/assets/input.js index d878dd02..bba504ef 100644 --- a/zellij-client/assets/input.js +++ b/zellij-client/assets/input.js @@ -91,7 +91,6 @@ export function setupInputHandlers(term, sendFunction) { // Mouse movement handler let terminal_element = document.getElementById("terminal"); terminal_element.addEventListener("mousemove", function (event) { - window.term.focus(); // this is a hack around: https://github.com/xtermjs/xterm.js/issues/1062 // in short, xterm.js doesn't listen to mousemove at all and so even though // we send it a request for AnyEvent mouse handling, we don't get motion events in return diff --git a/zellij-client/assets/terminal.js b/zellij-client/assets/terminal.js index a369f65a..bdaf637e 100644 --- a/zellij-client/assets/terminal.js +++ b/zellij-client/assets/terminal.js @@ -2,7 +2,7 @@ * Terminal initialization and management */ -import { build_link_handler } from './links.js'; +import { build_link_handler } from "./links.js"; /** * Initialize the terminal with all required addons and configuration @@ -20,7 +20,10 @@ export function initTerminal() { const clipboardAddon = new ClipboardAddon.ClipboardAddon(); const { linkHandler, activateLink } = build_link_handler(); - const webLinksAddon = new WebLinksAddon.WebLinksAddon(activateLink, linkHandler); + const webLinksAddon = new WebLinksAddon.WebLinksAddon( + activateLink, + linkHandler + ); term.options.linkHandler = linkHandler; const webglAddon = new WebglAddon.WebglAddon(); @@ -34,5 +37,6 @@ export function initTerminal() { term.loadAddon(webglAddon); term.open(document.getElementById("terminal")); fitAddon.fit(); + term.focus(); return { term, fitAddon }; } |
