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.
This commit is contained in:
David Lechner
2022-12-16 17:54:36 -06:00
committed by David Lechner
parent b7a9c20cfe
commit 10079a4d14
+4 -2
View File
@@ -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]);