RocketChat / RocketChat/Rocket.Chat
Global Escape key resets Navbar search even when search input is not active
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description
The Escape key listener in NavBarSearch.tsx is attached globally using tinykeys(window). Because of this, pressing Escape triggers handleEscSearch() even when the search input is not focused or the search dropdown is not open.
How I found the issue
While testing keyboard interactions, I noticed that pressing Escape anywhere in the app (for example, while typing in the chat input) still triggers the search reset logic.
Steps to reproduce
-
Start the Rocket.Chat development server
-
Open the app
-
Do not open the Navbar search
-
Focus the chat input
-
Press Escape
Actual behavior
Escape triggers handleEscSearch() even when the search is not active.
https://github.com/user-attachments/assets/5a728c16-788d-4d2d-a93c-03c2bfab955d
Expected behavior
Escape should reset the search only when the search input is focused or the search dropdown is open.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Inspect NavBarSearch.tsx and the global tinykeys(window) Escape listener, starting with how handleEscSearch() is triggered. Reproduce the behavior in the Rocket.Chat development server with Escape focused in the chat input; done means search resets only when its input is focused or its dropdown is open.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100