Skip to content

fix(app): block control characters that arrow keys insert on macOS - #8385

Open
Stiven-Gjekaj wants to merge 1 commit into
modrinth:mainfrom
Stiven-Gjekaj:fix/app-arrow-key-control-characters
Open

Stiven-Gjekaj wants to merge 1 commit into
modrinth:mainfrom
Stiven-Gjekaj:fix/app-arrow-key-control-characters

Conversation

@Stiven-Gjekaj

Copy link
Copy Markdown

When the caret cannot move any further in an input field, the arrow keys insert a control character. Right at the end of the text inserts U+001D, left at the start inserts U+001C, and up/down insert U+001E and U+001F. These characters get stored, for example in Java arguments.

Cause

The bug is in Tauri. It occurs when using the unstable multi webview feature (enabled by app-lib for the ads webview). The upstream issue is still open (tauri-apps/tauri#10194). This is a temporary mitigation in the frontend of the app, until the issue is fixed in Tauri.

Changes

Adds a single listener for beforeinput events on the document. If an insertText event occurs, but the inserted data contains only control characters, the event is cancelled. Other text input (including pasting) and newlines are unaffected.

Testing

This was tested in a dev build on macOS. Before this change, pressing the right arrow key would result in boxes being added after the text in the Java arguments field. After this change has been applied, no boxes are added. Typing and arrow key navigation all behave as expected. pnpm prepr:frontend:app passes.

Closes #8332

On macOS, the Tauri webview inserts U+001C to U+001F into a text input
when an arrow key cannot move the caret further. The app then saves
these characters, for example in the Java arguments.

Cancel each beforeinput insertText event that holds only control
characters. The upstream bug is tauri-apps/tauri#10194.

Fixes modrinth#8332
@github-actions

Copy link
Copy Markdown
Contributor

Pull request changelog

App

Added

Changed

Deprecated

Removed

Fixed

Security

Website

Added

Changed

Deprecated

Removed

Fixed

Security

Hosting

Added

Changed

Deprecated

Removed

Fixed

Security

@mergify

mergify Bot commented Nov 19, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue). If it does not match the queue conditions yet, it enters the queue once it does.

  • Queue this pull request

@Stiven-Gjekaj

Copy link
Copy Markdown
Author

Changelog suggestion for App, Fixed: Fixed arrow keys adding invisible characters to text fields on macOS, such as Java arguments.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

bug: pressing right arrow on the edit java arguments adds the U+001D unicode

1 participant