Auto-focus message composer on keypress with user toggle#7722
Auto-focus message composer on keypress with user toggle#7722AlexProgrammerDE wants to merge 2 commits intosignalapp:mainfrom
Conversation
Add auto-focus behavior that moves focus to the message composition input when a printable key is pressed, matching the UX of other major desktop messengers. Includes a user-facing toggle in Settings > Chats (default: on) and comprehensive guards against focus stealing from other inputs, keyboard shortcut interference, and non-printable keys. Supersedes signalapp#4998.
There was a problem hiding this comment.
Pull request overview
This PR implements an auto-focus feature for the message composition area that focuses the input when a printable key is pressed anywhere in the conversation view. It includes a user-facing toggle in Settings > Chats (defaulting to on) and supersedes PR #4998.
Changes:
- Adds
typingAutoFocussetting with storage, Redux selector, and UI toggle - Implements keyboard event listener in CompositionArea using
useDocumentKeyDownhook with guards for modifier keys, active inputs, and non-printable keys - Updates localization strings with title and description for the new setting
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| ts/types/StorageUIKeys.std.ts | Adds 'typingAutoFocus' to the UI storage keys array |
| ts/types/Storage.d.ts | Defines typingAutoFocus as a boolean in StorageAccessType |
| ts/state/smart/Preferences.preload.tsx | Creates storage accessor and passes toggle state/handler to Preferences component |
| ts/state/smart/CompositionArea.preload.tsx | Adds selector and passes isTypingAutoFocusEnabled to CompositionArea |
| ts/state/selectors/items.dom.ts | Creates getTypingAutoFocus selector with default value of true |
| ts/components/Preferences.dom.tsx | Adds checkbox UI for the typing auto-focus setting in Chats section |
| ts/components/Preferences.dom.stories.tsx | Updates story with hasTypingAutoFocus and handler for testing |
| ts/components/CompositionArea.dom.tsx | Implements keyboard listener with guards and calls focus() on printable key press |
| ts/components/CompositionArea.dom.stories.tsx | Adds isTypingAutoFocusEnabled prop to story |
| _locales/en/messages.json | Adds English strings for title and description of the new setting |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
CLA is signed. This is one of they key reasons I currently do not want to switch from e.g. WhatsApp and Discord to Signal. Having to manually focus the small message input box perfectly every time I wanna send a message (while it isnt focused but I am on the right page with the right intention) is tedious and other social media desktop apps have it figured out and it works wonderfully. This PR would finally bring this quality of life feature to Signal! |
|
I'd be happy to see this merged |
|
@scottnonnenberg-signal @josh-signal what do you think about this PR? Does this address your concerns from the other PR #4998? cc @indutny-signal, since you are assigned to PR #4998 |
First time contributor checklist:
Contributor checklist:
mainbranchpnpm run readyrun passes successfully (more about tests here)Summary
in the conversation view, matching behavior of Telegram, WhatsApp, Discord, and Slack
privacy-conscious users
Changes
typingAutoFocus(Storage, Redux selector, Preferences UI)useDocumentKeyDownhook in CompositionArea with guards for:Edge cases handled
Test plan