0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-03-14 12:16:09 +01:00

Fix focus lost bugs in the Monaco editor (#36609)

…t focus (#36585)

Currently, pressing the space key in the Monaco editor scrolls the page
instead of inserting a space
if the editor is focused. This PR stops the space key event from
propagating to parent elements,
which prevents unwanted page scrolling while still allowing Monaco to
handle space input normally.

Changes:
 - disable Monaco editContext

No changes to default editor behavior are needed; Monaco automatically
inserts the space character.

Signed-off-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
This commit is contained in:
Tyrone Yeh 2026-02-13 12:00:17 +08:00 committed by GitHub
parent 4f1408cdcf
commit 8e412ababf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,6 +38,7 @@ const baseOptions: MonacoOpts = {
scrollbar: {horizontalScrollbarSize: 6, verticalScrollbarSize: 6, alwaysConsumeMouseWheel: false},
scrollBeyondLastLine: false,
automaticLayout: true,
editContext: false, // https://github.com/microsoft/monaco-editor/issues/5081
};
function getEditorconfig(input: HTMLInputElement): EditorConfig | null {