Skip to content

fix(input): separate copy and paste event listeners (@yasith-tharuka) - #8371

Open
yasith-tharuka wants to merge 1 commit into
monkeytypegame:masterfrom
yasith-tharuka:fix/issue-8361-copy-paste
Open

fix(input): separate copy and paste event listeners (@yasith-tharuka)#8371
yasith-tharuka wants to merge 1 commit into
monkeytypegame:masterfrom
yasith-tharuka:fix/issue-8361-copy-paste

Conversation

@yasith-tharuka

Copy link
Copy Markdown

Description

  • Fixed copy and paste event listeners in frontend/src/ts/input/listeners/misc.ts. Previously, addEventListener("copy paste", ...) and addEventListener("select selectstart", ...) were used, but browsers treat space-separated strings as single unknown event names, preventing the handlers from firing.
  • Separated copy and paste into independent addEventListener calls with preventDefault().
  • Removed the dead select selectstart listener block since caret positioning is already handled by selectionchange.

Checks

  • Adding quotes?
  • Adding a language?
  • Adding a theme?
  • Adding a layout?
  • Adding a font?
  • Check if any open issues are related to this PR; if so, be sure to tag them below.
  • Make sure the PR title follows the Conventional Commits standard. (https://www.conventionalcommits.org for more info)
  • Make sure to include your GitHub username prefixed with @ inside parentheses at the end of the PR title.

Closes #8361

Copilot AI lite review requested due to automatic review settings August 28, 2026 08:10
@monkeytypegeorge monkeytypegeorge added the frontend User interface or web stuff label Aug 28, 2026
@github-actions github-actions Bot added the waiting for review Pull requests that require a review before continuing label Aug 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes broken copy/paste prevention on the hidden words input by registering real DOM event types (space-separated strings were treated as one unknown event name, so handlers never fired).

Changes:

  • Split "copy paste" into separate "copy" + "paste" addEventListener registrations.
  • Removed the dead "select selectstart" listener block (caret/selection handling already done via selectionchange).

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

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

Labels

frontend User interface or web stuff waiting for review Pull requests that require a review before continuing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: copy/paste prevention listeners never fire — space-separated event names passed to addEventListener

3 participants