microsoft / monaco-editor

A browser based code editor
https://microsoft.github.io/monaco-editor/
MIT License
40.04k stars 3.57k forks source link

Native "select all" shortcut (Ctrl + A) does not work in Editor searchbar input in webComponents #3938

Open caiotcunha opened 1 year ago

caiotcunha commented 1 year ago

Reproducible in vscode.dev or in VS Code Desktop?

Reproducible in the monaco editor playground?

Monaco Editor Playground Link

https://microsoft.github.io/monaco-editor/playground.html?source=v0.37.1#example-creating-the-editor-web-component

Monaco Editor Playground Code

customElements.define(
    "code-view-monaco",
    class CodeViewMonaco extends HTMLElement {
        _monacoEditor;
        /** @type HTMLElement */
        _editor;

        constructor() {
            super();

            const shadowRoot = this.attachShadow({ mode: "open" });

            // Copy over editor styles
            const styles = document.querySelectorAll(
                "link[rel='stylesheet'][data-name^='vs/']"
            );
            for (const style of styles) {
                shadowRoot.appendChild(style.cloneNode(true));
            }

            const template = /** @type HTMLTemplateElement */ (
                document.getElementById("editor-template")
            );
            shadowRoot.appendChild(template.content.cloneNode(true));

            this._editor = shadowRoot.querySelector("#container");
            this._monacoEditor = monaco.editor.create(this._editor, {
                automaticLayout: true,
                language: "html",

                value: `<div>Hello World</div>`,
            });
        }
    }
);

HTML
<template id="editor-template">
    <div
        id="container"
        style="overflow: hidden; width: 100%; height: 100%; position: absolute"
    ></div>
</template>

<code-view-monaco></code-view-monaco>

Reproduction Steps

-Press ctrl + F to open the search input in monaco editor -Type anything in search input -Press ctrl + A to select all in the search input (does nothing)

Actual (Problematic) Behavior

Native "select all" shortcut (Ctrl + A) does not work in Editor searchbar input in webComponents

Expected Behavior

Native "select all" shortcut (Ctrl + A) select all typed words in search input

Additional Context

No response

guilhermegia commented 1 year ago

Same problem here (Up)

guilhermegia commented 1 year ago

Hello, any updates?

Ruminat commented 10 months ago

We've encountered the same problem