From 10079a4d14cfb53a003e5f926e95422da529692e Mon Sep 17 00:00:00 2001 From: David Lechner Date: Thu, 15 Dec 2022 18:37:53 -0600 Subject: [PATCH] terminal: exclude from keyboard tab focus Since the terminal "steals" the tab key, we don't want to include it in the keyboard tab list. It is still mouse focusable and we will implement an landmark role for the terminal for assistive technologies. --- src/terminal/Terminal.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/terminal/Terminal.tsx b/src/terminal/Terminal.tsx index c159b07a..eba3bbf6 100644 --- a/src/terminal/Terminal.tsx +++ b/src/terminal/Terminal.tsx @@ -113,9 +113,11 @@ const Terminal: React.FC = (_props) => { xterm.open(terminalRef.current); fitAddon.fit(); - // HACK: remove tabindex from main xterm element, otherwise it takes - // two tabs to get to the text area + // HACK: remove terminal from keyboard tab focus + // Since it steals tab key presses, there is no way + // to get out of it, so we use landmark navigation instead. xterm.element?.removeAttribute('tabindex'); + xterm.textarea?.setAttribute('tabindex', '-1'); return () => xterm.dispose(); }, [xterm]);