Skip to content

fix(repo-editor): disable Monaco editContext to avoid bugs with lost focus#36585

Merged
silverwind merged 5 commits intogo-gitea:mainfrom
tyroneyeh:main_codeEditorCannotSpace
Feb 12, 2026
Merged

fix(repo-editor): disable Monaco editContext to avoid bugs with lost focus#36585
silverwind merged 5 commits intogo-gitea:mainfrom
tyroneyeh:main_codeEditorCannotSpace

Conversation

@tyroneyeh
Copy link
Copy Markdown
Contributor

@tyroneyeh tyroneyeh commented Feb 11, 2026

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.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Feb 11, 2026
@silverwind
Copy link
Copy Markdown
Member

Currently, pressing the space key in the Monaco editor scrolls the page

On which browsers are you seeing this? I can not reproduce on Firefox and Chrome on MacOS at least.

@tyroneyeh
Copy link
Copy Markdown
Contributor Author

On which browsers are you seeing this? I can not reproduce on Firefox and Chrome on MacOS at least.

I only have a problem with Chrome on Linux Plasma6, tab key is ok
2026-02-11a

@silverwind
Copy link
Copy Markdown
Member

Maybe it's losing focus somehow? I found microsoft/monaco-editor#5081. Check if microsoft/monaco-editor#5081 (comment) also works.

@tyroneyeh
Copy link
Copy Markdown
Contributor Author

add editContext: false is work

@silverwind
Copy link
Copy Markdown
Member

That might be the better workaround. Are you doing anything unusual to trigger the bug like "moving browser windows between monitors" like mentioned in that issue?

Signed-off-by: silverwind <me@silverwind.io>
@silverwind
Copy link
Copy Markdown
Member

Added backport label because editContext was added in Monaco 0.53 and that version is in use in the v1.25 branch.

@tyroneyeh
Copy link
Copy Markdown
Contributor Author

That might be the better workaround. Are you doing anything unusual to trigger the bug like "moving browser windows between monitors" like mentioned in that issue?

Nothing special, just open the file and click edit.

@silverwind silverwind changed the title fix(repo-editor): stop space propagation in Monaco editor fix(repo-editor): disable Monaco editContext to avoid bugs with spacebar Feb 11, 2026
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Feb 11, 2026
@silverwind silverwind changed the title fix(repo-editor): disable Monaco editContext to avoid bugs with spacebar fix(repo-editor): disable Monaco editContext to avoid bugs with lost focus Feb 11, 2026
@silverwind silverwind requested a review from Copilot February 11, 2026 18:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to address Monaco editor focus/input issues by disabling Monaco’s editContext integration in the repo’s code editor configuration.

Changes:


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@silverwind silverwind changed the title fix(repo-editor): disable Monaco editContext to avoid bugs with lost focus fix(repo-editor): disable Monaco editContext to avoid bugs with lost focus Feb 11, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Feb 12, 2026
@silverwind silverwind added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 12, 2026
@silverwind silverwind enabled auto-merge (squash) February 12, 2026 18:35
@silverwind silverwind merged commit 514f322 into go-gitea:main Feb 12, 2026
24 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Feb 12, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Feb 12, 2026
@GiteaBot
Copy link
Copy Markdown
Collaborator

I was unable to create a backport for 1.25. @tyroneyeh, please send one manually. 🍵

go run ./contrib/backport 36585
...  // fix git conflicts if any
go run ./contrib/backport --continue

@GiteaBot GiteaBot added the backport/manual No power to the bots! Create your backport yourself! label Feb 12, 2026
@tyroneyeh tyroneyeh deleted the main_codeEditorCannotSpace branch February 12, 2026 23:07
tyroneyeh added a commit to tyroneyeh/gitea that referenced this pull request Feb 13, 2026
…t focus (go-gitea#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>
tyroneyeh added a commit to tyroneyeh/gitea that referenced this pull request Feb 13, 2026
…t focus (go-gitea#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>
silverwind added a commit that referenced this pull request Feb 13, 2026
…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>
silverwind added a commit to silverwind/gitea that referenced this pull request Feb 14, 2026
* origin/main: (2555 commits)
  automate updating nix flakes (go-gitea#35641)
  Update AGENTS.md instructions (go-gitea#36627)
  use user id in noreply emails (go-gitea#36550)
  feat(db): Improve BuildCaseInsensitiveLike with lowercase (go-gitea#36598)
  [skip ci] Updated translations via Crowdin
  BUG: Fix workflow run jobs API returning null steps (go-gitea#36603)
  Refactor highlight and diff (go-gitea#36599)
  Fix bug when do LFS GC (go-gitea#36500)
  feature to be able to filter project boards by milestones (go-gitea#36321)
  Update emoji data for Unicode 16 (go-gitea#36596)
  Adapt monaco error matching pattern to recent webpack config change (go-gitea#36533)
  Fix a bug user could change another user's primary email (go-gitea#36586)
  fix(repo-editor): disable Monaco `editContext` to avoid bugs with lost focus (go-gitea#36585)
  Fine tune diff highlighting (go-gitea#36592)
  Add code editor setting dropdowns (go-gitea#36534)
  Update to go 1.26.0 and golangci-lint 2.9.0 (go-gitea#36588)
  Improve diff highlighting (go-gitea#36583)
  Fix markup code block layout (go-gitea#36578)
  Remove striped tables in UI (go-gitea#36509)
  Fix vertical alignment of `.commit-sign-badge` children (go-gitea#36570)
  ...

# Conflicts:
#	custom/conf/app.example.ini
#	docs/content/administration/config-cheat-sheet.en-us.md
#	docs/content/administration/config-cheat-sheet.zh-cn.md
#	modules/setting/security.go
#	routers/common/errpage.go
#	services/context/api.go
#	services/context/context.go
Sirherobrine23 pushed a commit to Sirherobrine23/gitea that referenced this pull request Mar 4, 2026
…t focus (go-gitea#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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport/manual No power to the bots! Create your backport yourself! backport/v1.25 lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. modifies/frontend type/bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants