Skip to content

Conversation

@dylantientcheu
Copy link
Collaborator

Search Button: Enhanced keyboard shortcut visual feedback

Adds interactive visual feedback to search button keyboard shortcuts, showing pressed state for modifier and K keys.

Description

  • Keyboard shortcuts now display pressed state with visual highlighting when keys are held
  • Automatically detects platform (Mac vs Windows/Linux) to show correct modifier key (⌘ vs Ctrl)
  • Applies consistent improvements to both search and search-askai components

@netlify
Copy link

netlify bot commented Nov 20, 2025

Deploy Preview for sitesearch-docs ready!

Name Link
🔨 Latest commit 8b52c5e
🔍 Latest deploy log https://app.netlify.com/projects/sitesearch-docs/deploys/691efa4dbe0dc70008b887e8
😎 Deploy Preview https://deploy-preview-6--sitesearch-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines 770 to +774
useEffect(() => {
const handleKeyDown = (event: KeyboardEvent) => {
const isModifierPressed =
modifierKey === "cmd"
? event.metaKey || event.ctrlKey
: event.getModifierState(
modifierKey.charAt(0).toUpperCase() + modifierKey.slice(1),
);

if (isModifierPressed && event.key.toLowerCase() === key) {
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
event.preventDefault();
openModal();
setIsModalOpen(true);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Cmd/Ctrl+K opens every search modal on a page

This handler is now hard-coded to Cmd/Ctrl+K for every instance, and the same change was applied to the AskAI variant in this commit. Pages that render multiple search experiences at once (e.g., the docs homepage hosts both Search and SearchWithAskAI) will now register two identical global listeners, so pressing Cmd/Ctrl+K opens both modals simultaneously instead of one, unlike the previous distinct shortcuts. Please reintroduce per-instance shortcuts or a way to disable the hotkey when multiple experiences coexist.

Useful? React with 👍 / 👎.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True but we don't want to have much code and complexity only for this, plus usually people will have only one search bar on screen at a time.

Maybe add the possibility to NOT listen ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants