Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

terminalFocus.ts

7 lines359 Bytes

1export function isTerminalFocused(): boolean {
2 const activeElement = document.activeElement;
3 if (!(activeElement instanceof HTMLElement)) return false;
4 if (!activeElement.isConnected) return false;
5 if (activeElement.classList.contains("xterm-helper-textarea")) return true;
6 return activeElement.closest(".thread-terminal-drawer .xterm") !== null;
7}