JS tip: add a Cmd+K palette without a library.
document.addEventListener('keydown', e => {
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {
e.preventDefault();
palette.showModal();
}
});
A native <dialog> handles Escape, focus and the backdrop.
JS tip: add a Cmd+K palette without a library. document.addEventListener('keydown', e => { if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') { e.preventDefault(); palette.showModal(); } }); A native <dialog> handles Escape, focus and the backdrop.
0 vue
Publié le 10/11/2026 13:08
JS tip: add a Cmd+K palette without a library.
document.addEventListener('keydown', e => {
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k') {
e.preventDefault();
palette.showModal();
}
});
A native <dialog> handles Escape, focus and the backdrop.
markodenic.tech/give-your-si...