ProtonMail / ProtonMail/WebClients

Avoid refocusing an already-focused Rooster editor on click

Open Beginner friendly
#537 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
5.6k
Forks
715
PR merge metrics
No merged PRs in 30d

Description

useInitRooster currently calls editor.focus() for every Rooster wrapper click, including when the editor already has focus.

Wrapper clicks should call editor.focus() only when editor.hasFocus() is false. The onFocus callback should still run for every wrapper click.

A focused red/green test confirms that the already-focused case fails before this change and that both the focused and unfocused cases pass with it.

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

Start at useInitRooster and run the focused red/green test described in the issue. Verify that wrapper clicks focus the editor only when editor.hasFocus() is false, while onFocus still runs for every click; done means both focused and unfocused cases pass.

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
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.