Repository navigation
fix(app): block control characters that arrow keys insert on macOS - #8385
Open
Stiven-Gjekaj wants to merge 1 commit into
Open
Stiven-Gjekaj wants to merge 1 commit into
Stiven-Gjekaj wants to merge 1 commit into
Conversation
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
Contributor
Pull request changelogAppAddedChangedDeprecatedRemovedFixedSecurityWebsiteAddedChangedDeprecatedRemovedFixedSecurityHostingAddedChangedDeprecatedRemovedFixedSecurity |
|
Tick the box to add this pull request to the merge queue (same as
|
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
beforeinputevents on the document. If aninsertTextevent 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:apppasses.Closes #8332