Skip to content

Comments

Fix web clipboard events in SelectionContainer#2700

Merged
eymar merged 3 commits intojb-mainfrom
ok/fix_clipboard_events_in_selection_container
Jan 20, 2026
Merged

Fix web clipboard events in SelectionContainer#2700
eymar merged 3 commits intojb-mainfrom
ok/fix_clipboard_events_in_selection_container

Conversation

@eymar
Copy link
Member

@eymar eymar commented Jan 20, 2026

Some browsers do not dispatch clipboard events to the <canvas> element - they don't expect that a canvas would have anything to copy.

Introduce the clipTarget textarea element to receive clipboard events for better browser compatibility.

Fixes https://youtrack.jetbrains.com/issue/CMP-9508

Testing

This should be tested by QA

Release Notes

Fixes - Web

  • Fix Ctrl/Cmd + C (copy) event handling for the selected text wrapped in SelectionContainer

@eymar eymar force-pushed the ok/fix_clipboard_events_in_selection_container branch 2 times, most recently from ca27c8b to ce698f3 Compare January 20, 2026 11:12
@eymar eymar force-pushed the ok/fix_clipboard_events_in_selection_container branch from ce698f3 to de88e16 Compare January 20, 2026 11:12
@eymar eymar requested a review from terrakok January 20, 2026 11:13
@eymar
Copy link
Member Author

eymar commented Jan 20, 2026

@junie-agent

Your Task

  1. Download the Pull Request diff using:
    gh pr diff ${{ github.event.pull_request.head.ref }}

  2. Review only:

  • the code changed in the diff
  • code that is directly or closely connected to the changed code
    Do not explore other parts of the repository.
  1. Perform the review according to the criteria below.
  2. Write GitHub comment for every issue you found.
  3. Do not write any summary about the pull request. Only the issues you found.

You MUST NOT:

  • run the code
  • build the project
  • execute tests
  • explore the repository beyond the files included in the diff.
  • make any changes in the code review
  • commit anything into the code review branch
  • write code review summary

Review Scope

1. Comments

Use professional and polite language.

  • Add a comment if you are absolutely sure about an issue you have found in the code; otherwise, skip it.
  • Do not write comments if you are unsure about an issue in the code.
  • Do not write a summary of the code review. Only write comments on specific issues if they are identified.
  • Only write about issues that you have found. Don't write anything else.
  • If issues found, write comments using the flolwing output format:

⚠️ 2 issues found

  1. [full path to the issue file] : [line number]
    [short comment for the issue 1]

  2. [full path to the issue file] : [line number]
    [short comment for the issue 2]

  • If no issues found, write only this line and nothing else:

✅ No issues found

2. Check criteria

  • Verify that the code changes corresponding the PR title and description.
  • Verify any grammar mistakes in the diff. Don't highlight grammar mistakes outside the pull request's diff.
  • Use deep knowledge about algorithms and data structures to find potential issues in the code.
  • Deeply analyze logic of algorithms that are changed in the PR and find inconsistencies between the implementation and expected behaviour.
  • Check for common typos in the code logic, like == vs !=.
  • Any other issues that crucial for the code review.

@github-actions
Copy link

github-actions bot commented Jan 20, 2026

Junie successfully finished!

Result: Review Web Clipboard Events Fix in SelectionContainer

⚠️ 2 issues found

  1. compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/window/ComposeWindowInternal.web.kt : 351
    On macOS, including isCtrlPressed in the shortcut check can cause focus to be permanently lost to the hidden textarea, as browsers typically don't dispatch clipboard events for Ctrl+C/V/X on Mac. It is recommended to only use isMetaPressed for macOS clipboard shortcuts.

  2. compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/window/ComposeWindowInternal.web.kt : 677
    Grammar mistake in comment: "to canvas" should be "to the canvas". Additionally, "let a browser" (lines 357, 676) should be "let the browser".

@eymar eymar merged commit 521f01b into jb-main Jan 20, 2026
17 checks passed
@eymar eymar deleted the ok/fix_clipboard_events_in_selection_container branch January 20, 2026 12:24
eymar added a commit that referenced this pull request Jan 20, 2026
Some browsers do not dispatch clipboard events to the `<canvas>` element
- they don't expect that a canvas would have anything to copy.

Introduce the `clipTarget` textarea element to receive clipboard events
for better browser compatibility.

Fixes https://youtrack.jetbrains.com/issue/CMP-9508

## Testing
This should be tested by QA

## Release Notes
### Fixes - Web
- Fix `Ctrl/Cmd + C` (copy) event handling for the selected text wrapped
in SelectionContainer
eymar added a commit that referenced this pull request Jan 20, 2026
Some browsers do not dispatch clipboard events to the `<canvas>` element
- they don't expect that a canvas would have anything to copy.

Introduce the `clipTarget` textarea element to receive clipboard events
for better browser compatibility.

Fixes https://youtrack.jetbrains.com/issue/CMP-9508

## Testing
This should be tested by QA

## Release Notes
### Fixes - Web
- Fix `Ctrl/Cmd + C` (copy) event handling for the selected text wrapped
in SelectionContainer
siarb added a commit that referenced this pull request Jan 20, 2026
Cherry-pick from
#2700

Fixes https://youtrack.jetbrains.com/issue/CMP-9508

## Testing
This should be tested by QA

## Release Notes
### Fixes - Web
- Fix `Ctrl/Cmd + C` (copy) event handling for the selected text wrapped
in SelectionContainer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants