microsoft / microsoft/monaco-editor

[Bug] Setting tabFocusMode on initial monaco.editor.create does not properly set value

Open
#4,424 1 comment 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
46.8k
Forks
4.1k
Avg merge
17h 58m
Merged PRs (30d)
1

Description

Reproducible in vscode.dev or in VS Code Desktop?
  • Not reproducible in vscode.dev or VS Code Desktop
Reproducible in the monaco editor playground?
Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.47.0#XQAAAAL9AQAAAAAAAABBqQkHQ5NjdMjwa-jY7SIQ9S7DNlzs5W-mwj0fe1ZCDRFc9ws9XQE0SJE1jc2VKxhaLFIw9vEWSxW3yscw0SDhjZmn-5ctzOK0Uo_OoWMOa4kdjBQIo4UQeK366lCw9QWZDHtw3_iKUka_Yh_SpXYthONT3PHkXELFwH48wSnlFrCBmJD91KLgBE0oLQYfWVC1l8lMFAEDI2KHKNegcHXLXjyz6nT_EIbcxdog20EoUu7Q0Oji1PNsfp-4qn-s2_df1NUtCcTUwEqkvsO8zF0jaW8TjFyFJkkECNM6j8PmusD4jgp2z4wsQEsGzkNRAG7b0CGrt56J-OPcLUveQJrxiJVhi5Qt0JhVpVJPkPqUW4n5vNg2Fjsi_IxzBYZVXdiVtEvnZ_zigDhHntCH9ual1Xha9Qar5OjeTetMVz_MqCV4ZXp7fueixEQHds63atg6jNND9zmXamokyyMBnG_C3pok0lI-KLwcz4cCMkPkZSDAJQooFf_l_777rHw

Monaco Editor Playground Code
const value = /* set from `myEditor.getModel()`: */ `function hello() {
	alert('Hello world!');
}`;

// Hover on each property to see its docs!
const myEditor = monaco.editor.create(document.getElementById("container"), {
	value,
	language: "javascript",
	automaticLayout: true,
	tabFocusMode: true, // This does not work
});

//Workaround
myEditor.trigger("Test", "editor.action.toggleTabFocusMode", true); //Have to manually do this
Reproduction Steps

Comment out the "myEditor.trigger" command. See that you get tab trapping. Uncomment it, and see that workaround fixes it.

Actual (Problematic) Behavior

As far as I can tell from documentation, the tabFocusMode property is supposed to set the toggletabfocusMode on the editor, but it does not seem to do that.

Expected Behavior

Setting tabFocusMode to true should automatically disable tab trapping

Additional Context

There is a workaround for now, but it seems like the setup feature is incorrect.

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 with the Monaco Editor Playground link and the provided create call, comparing tabFocusMode: true with the editor.action.toggleTabFocusMode workaround. Verify the initial option's behavior with the reproduction steps and determine whether it matches the expected disabling of tab trapping. Done means the initial setting behaves like the workaround without requiring myEditor.trigger.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
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.