microsoft / monaco-editor

A browser based code editor

Home Page:https://microsoft.github.io/monaco-editor/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

chaycer opened this issue · comments

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.