Skip to content

feat: auto-focus inputs on typing and pasting#146

Open
julianbenegas wants to merge 1 commit intomainfrom
forums/auto-focus-on-type-2637b
Open

feat: auto-focus inputs on typing and pasting#146
julianbenegas wants to merge 1 commit intomainfrom
forums/auto-focus-on-type-2637b

Conversation

@julianbenegas
Copy link
Copy Markdown
Member

Add a useAutoFocusOnType hook that automatically focuses the main
input/textarea when the user starts typing or pastes text, without
stealing focus from other interactive elements.

The hook:

  • Listens for keydown (printable characters only) and paste events
  • Skips if another input, textarea, select, or contenteditable is focused
  • Skips if focus is inside a dialog, menu, listbox, combobox, or popup
  • Skips if modifier keys (Cmd/Ctrl/Alt) are held (Shift is allowed)
  • For paste, uses native value setter to work with React controlled inputs

Applied to:

  • Composer (textarea on repo page and post page)
  • RepoListWithSearch (search input on homepage)
  • RepoSearchInput (standalone search input)

Add a useAutoFocusOnType hook that automatically focuses the main
input/textarea when the user starts typing or pastes text, without
stealing focus from other interactive elements.

The hook:
- Listens for keydown (printable characters only) and paste events
- Skips if another input, textarea, select, or contenteditable is focused
- Skips if focus is inside a dialog, menu, listbox, combobox, or popup
- Skips if modifier keys (Cmd/Ctrl/Alt) are held (Shift is allowed)
- For paste, uses native value setter to work with React controlled inputs

Applied to:
- Composer (textarea on repo page and post page)
- RepoListWithSearch (search input on homepage)
- RepoSearchInput (standalone search input)
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
forums Ready Ready Preview, Comment Apr 24, 2026 7:58pm

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.

1 participant