VS Code Web: floating Go-to-File button
Adds a floating button that opens the Go to File picker, useful on touch screens (works on github.dev too).
Code to copy
/* Floating Go-to-File button that opens the quick picker (works on github.dev too) */
(function () {
if (document.getElementById('vsc-floating-goto')) return;
const btn = document.createElement('button');
btn.id = 'vsc-floating-goto';
btn.textContent = 'Go to file';
Object.assign(btn.style, {
position: 'fixed', right: '16px', bottom: '60px', zIndex: 99999,
padding: '10px 16px', background: '#ff8a3d', color: '#fff',
border: 'none', borderRadius: '999px', boxShadow: '0 2px 10px rgba(0,0,0,0.3)',
cursor: 'pointer', fontFamily: 'system-ui, sans-serif', fontSize: '13px'
});
btn.addEventListener('click', () => {
const target = document.querySelector('.monaco-editor textarea.inputarea') || document.body;
target.focus();
target.dispatchEvent(new KeyboardEvent('keydown', {
key: 'p', code: 'KeyP', ctrlKey: true, bubbles: true, cancelable: true
}));
});
document.body.appendChild(btn);
})();
How to use this example
- Copy the code with the button above.
- Install JustZix (2 minutes) and open the extension on the target page.
- Add a new rule matching that page.
- Paste the code into the rule's JavaScript panel and save — it runs on every page visit.
Rate this example
No ratings yet — be the first.