[doc] Search - focus with Ctrl+K keyboard shortcut
Opened this issue · 0 comments
hakenr commented
Inspiration
const handleCk = (event: KeyboardEvent) => {
if (event.ctrlKey || event.metaKey) {
if (event.key?.toLowerCase() === "k") {
event.preventDefault();
inputRef.current.focus();
}
}
};
window.addEventListener("keydown", handleCk);
return () => {
window.removeEventListener("keydown", handleCk);
};
We should add some UX hint, such as
(Might be customized to Cmd+K on MacOS.)
We might consider adding support for keyboard shortcut to HxSearchBox
(search in doc might be ported to HxSearchBox
instead of current HxAutosuggest
implementation).