diff --git a/static/toolbar.js b/static/toolbar.js index 24ec023..24bfe98 100644 --- a/static/toolbar.js +++ b/static/toolbar.js @@ -111,18 +111,14 @@ 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'); - } - } + // Ensure terminal keeps focus (prevents Tab from escaping to browser chrome) + document.addEventListener('click', function(e){ + if(!e.target.closest('#mb') && window.term) window.term.focus(); }); + // Remove tabindex from toolbar buttons so Tab can't escape to them + bar.querySelectorAll('button').forEach(function(b){ b.tabIndex = -1; }); + // Shrink terminal for toolbar on mobile (2 rows) var obs=new MutationObserver(function(){ var el=document.querySelector('.xterm');