Skip to content

feat(search): add '/' keyboard shortcut to focus search field' - #34

Open
sreeragvs123 wants to merge 1 commit into
tkmfoss:mainfrom
sreeragvs123:sreerag
Open

sreeragvs123 wants to merge 1 commit into
tkmfoss:mainfrom
sreeragvs123:sreerag

Conversation

@sreeragvs123

@sreeragvs123 sreeragvs123 commented Oct 24, 2026 •

Copy link
Copy Markdown

Summary

Add a keyboard shortcut (/) to quickly focus the search input field, making the primary action of the app faster to reach.

Related issue

Closes #6

Changes made

  • Added a global keydown event listener in js/app.js to listen for the / key.
  • Implemented checks to ignore the shortcut when the event target is a form control (input, textarea, select, or contenteditable elements) to prevent interfering with normal typing.
  • Added event.preventDefault() and called searchInput.focus() when the shortcut is triggered successfully.

Testing performed

  • I ran the site locally and tested the change.
  • I checked the browser console for errors.
  • I tested on desktop and mobile widths.
  • Other (please describe):

Screenshots

(Optional: You can attach a screen recording or note that a keyboard shortcut doesn't require visual screenshot changes)

Contributor checklist

  • My change follows the existing code style.
  • I have tested my change locally.
  • I have not committed unrelated files.
  • I have commented my code where non-obvious logic lives.

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.

add-a-keyboard-shortcut-to-focus-the-search-field

1 participant