Open bbelderbos opened 7 months ago
@bbelderbos Correct me if I am wrong, but does this require updating event keys and event listener? I think that is written in JS.
Yes you would do this in JS, adding a document.addEventListener
.
I did something similar for another project, maybe this helps:
document.addEventListener('keydown', function(event) {
// Check if Command (for Mac) or Ctrl (for Windows/Linux) is pressed along with 'K'
if ((event.metaKey || event.ctrlKey) && event.key === 'k') {
// Prevent default action to ensure no other action is performed with the same shortcut
event.preventDefault();
// Get the search box by its ID and focus on it
let searchBox = document.getElementById('search');
if (searchBox) {
searchBox.focus();
}
}
});
Circle uses ⌘K to open search, but
/
would be nice too (my Vim bias)