microsoft / microsoft/monaco-editor

Prevent formatDocument to steal focus

Open
#1,245 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

feature-request help wanted open for PR
Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

monaco-editor version: 0.15.6
Browser: chrome
OS: linux

I use this.editor.getAction('editor.action.formatDocument').run() to format a document. This works, but it also set's the focus to the the editor. Is that intended behaviour? Is there a way to disable the change of focus?

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 by reproducing the focus change in Chrome on Linux with Monaco Editor 0.15.6 using this.editor.getAction('editor.action.formatDocument').run(). Trace the formatDocument action's focus behavior and determine whether formatting can complete without moving focus; done means the document still formats while the previously focused element remains focused.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.