[Feature Request] Ctrl+K For Search
Description
Ctrl+K For Search
Suggested Solution
Simply Add My Script To Body
const handleKeyDown = (event) => {
if ((event.ctrlKey || event.metaKey) && event.key === 'k') {
event.preventDefault();
input.focus();
}
};
const input = document.querySelector(".rio-input-box-column input");
document.addEventListener('keydown', handleKeyDown);
Alternatives
No response
Additional Context
No response
Related Issues/Pull Requests
No response
Thank you for always trying to provide solutions, but remember Rio is a Python framework. JavaScript & CSS aren't used on the Rio website.
It'll probably be quite a while before we figure out how we want to handle keyboard shortcuts in rio, so I think we should (temporarily) solve this via JS. We could run the given JS code in on_session_start, using Session._evaluate_javascript.
We don't have a high-level way of handling shortcuts, but neither has JavaScript. Any reason we can't handle this with a KeyEventListener?
How would the KeyEventListener focus the search bar?
I was responding to this
It'll probably be quite a while before we figure out how we want to handle keyboard shortcuts in Rio, so I think we should (temporarily) solve this via JS.
Btw, Ctrl+k doesn't normally focus the search, but rather open a sort of quick navigation. With that said, just focusing the search could be a quicak approximation of this behavior, that's much easier to create. Example from discord: