Repository navigation
Conversation
The paste listener on the window took every paste on the page and prevented the browser's own, so pasting into a text field next to the canvas did nothing. Copy, cut and paste now reach the app only while its canvas has the focus, as its keys do. They're still heard on the window, since Firefox sends them to the body, and every browser to the page's selection when there is one, rather than to the focused canvas. Copy and cut also read the event they're given, not the global `event`. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Tigon32
added a commit
to Tigon32/miniquad
that referenced
this pull request
Nov 10, 2026
Tigon32
added a commit
to Tigon32/miniquad
that referenced
this pull request
Nov 10, 2026
…ot-fl3#698, not-fl3#602 (#1) * Integrate upstream PRs not-fl3#701, not-fl3#698, not-fl3#602: js/gl.js * ci: add targeted Rust WebAssembly and JS build checks * ci: allow generating Cargo.lock for library builds
This was referenced Nov 10, 2026
Closed
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.
Why
On the web, gl.js listens for
pasteon the window and always callspreventDefault()andstopPropagation(), to hand the text to the app. So a page that puts any text field next to the canvas, such as a name field or a search box, can't paste into it: the browser never inserts the text. Thecopyandcutlisteners would likewise replace whatever a field copies with the app's clipboard, once the app has set one, and they read the globaleventrather than the event they're given.Change
copy,cutandpastereach the app only while its canvas isdocument.activeElement, as its keys do (they're listened for on the canvas). Anywhere else, gl.js leaves the event to the browser.They're still listened for on the window rather than the canvas: Firefox sends a paste on a focused canvas to
<body>, and every browser sends it to the page's selection when there is one, so a listener on the canvas would miss them.Verification
In a macroquad game (CHOMP) built for the web, through Playwright on macOS, with two
<input>s added to the page: text copied from one, then pasted into the other, then pasted with the canvas focused.on_clipboard_pasteon_clipboard_paste🤖 Generated with Claude Code