fix: intercept Tab key to prevent browser focus navigation
Tab key was being captured by the browser for focus cycling instead of being sent to the terminal for bash completion. Now intercepted at the document level and forwarded to the terminal when xterm has focus.
This commit is contained in:
@@ -111,6 +111,18 @@
|
|||||||
if(btn.dataset.k) send(btn.dataset.k);
|
if(btn.dataset.k) send(btn.dataset.k);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Prevent browser from stealing Tab key — send it to the terminal instead
|
||||||
|
document.addEventListener('keydown', function(e){
|
||||||
|
if(e.key === 'Tab' && !e.altKey && !e.ctrlKey && !e.metaKey){
|
||||||
|
var active = document.activeElement;
|
||||||
|
// Only intercept if focus is on the terminal or body (not on toolbar buttons)
|
||||||
|
if(!active || active === document.body || active.closest('.xterm')){
|
||||||
|
e.preventDefault();
|
||||||
|
send('\t');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// Shrink terminal for toolbar on mobile (2 rows)
|
// Shrink terminal for toolbar on mobile (2 rows)
|
||||||
var obs=new MutationObserver(function(){
|
var obs=new MutationObserver(function(){
|
||||||
var el=document.querySelector('.xterm');
|
var el=document.querySelector('.xterm');
|
||||||
|
|||||||
Reference in New Issue
Block a user