Replies: 1 comment
-
I'm not sure what element that has a tabindex you're referring to? Isn't it just the textarea that can be focused? The general question of how to handle tab and other potentially conflicting keybindings is a difficult one. You can read how VS Code handles it here: https://code.visualstudio.com/docs/terminal/advanced#_keybinding-and-the-shell. There's also "tab focus mode" (ctrl+m) which forces tab navigation in the terminal and editor. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Howdy! For discussion, I'm working on a project which includes multiple xtermjs terminals and other widgets on the page. One of these terminals is the primary input of the application, but users are encouraged to interact with other widgets. I do not want xtermjs's event capturing to disrupt keyboard users.
Given the simple setup:
Developers can listen for blur/focus events. I've seen StackOverflow posts and xtermjs github issues describing both methods below:
As the user navigates the page with keyboard and cursor, both events on both targets fire as-expected. However, once an xtermjs terminal is focused, focus becomes trapped for keyboard users, i.e.
tab
andshift+tab
will not fire the blur event.Looking at docs, and developers can prevent xtermjs keyboard events:
At first blush, this mostly does the trick! It's not even necessary to test for the combination of shift and tab. Unfortunately, there are two layers of blurring and focusing. The user can tab between the textarea and element of the terminal which is awkward, but semi-functional. Removing the tabindex from the non-textarea might solve this issue.
I'm concerned this code is fragile. Are there other types of events that should cause blur or focus and I am still trapping them?
Are there other approaches folks have tried?
Thanks
Edits for additional observations:
disableStdin
flag seems does not prevent xtermjs from mounting textarea element and setting tabindex=0 on the textarea and xterm elements.Beta Was this translation helpful? Give feedback.
All reactions