monaco-editor icon indicating copy to clipboard operation
monaco-editor copied to clipboard

[Feature Request] Request for Editor.focus method optional params support

Open ivanksh opened this issue 2 years ago • 2 comments

Context

  • [X] This issue is not a bug report. (please use a different template for reporting a bug)
  • [X] This issue is not a duplicate of an existing issue. (please use the search to find existing issues)

Description

It would be great if Editor.focus method supported optional params (preventScroll, focusVisible - https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#parameters) and used these params when focusing in editor textarea

The reason: We are using Editor inside nodes within some canvas and have the feature of auto focusing Editor within newly added node. As by default preventScroll is false this causes unintentional browser scrolling the document to bring the newly-focused element into view and this is the reason for some UI issues. If Editor.focus supports preventScroll parameter we can easily control browser behavior on focus

Monaco Editor Playground Link

No response

Monaco Editor Playground Code

No response

ivanksh avatar Nov 08 '23 16:11 ivanksh

Related: #4042

hediet avatar Dec 14 '23 10:12 hediet

Can you provide monaco editor playground example that demonstrates the problem? Thanks!

hediet avatar Dec 14 '23 10:12 hediet