RocketChat / RocketChat/Rocket.Chat

Global Escape key resets Navbar search even when search input is not active

Open
#39,462 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
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
  1. Start the Rocket.Chat development server

  2. Open the app

  3. Do not open the Navbar search

  4. Focus the chat input

  5. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.