havit/Havit.Blazor

[doc] Search - focus with Ctrl+K keyboard shortcut

Opened this issue · 0 comments

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
image

(Might be customized to Cmd+K on MacOS.)
image

We might consider adding support for keyboard shortcut to HxSearchBox (search in doc might be ported to HxSearchBox instead of current HxAutosuggest implementation).