Skip to content

Writing flow: respect text fields inside open shadow roots - #82820

Open
dilipom13 wants to merge 2 commits into
WordPress:trunkfrom
dilipom13:fix/82755-shadow-dom-writing-flow
Open

dilipom13 wants to merge 2 commits into
WordPress:trunkfrom
dilipom13:fix/82755-shadow-dom-writing-flow

Conversation

@dilipom13

Copy link
Copy Markdown
Contributor

What

Fixes #82755

Select-all and paste now use the composed event target, so text fields inside open shadow roots keep native Cmd/Ctrl+A and paste behaviour instead of triggering block-level operations.

How

  • Add getEventTarget() helper using event.composedPath()[0]
  • Use it in writing-flow select-all and clipboard handlers
  • Let native clipboard behaviour win when the composed target is a text field

Test plan

Use the composed event target for select-all and clipboard handling so Cmd/Ctrl+A and paste operate on shadow DOM text fields instead of replacing blocks.
@dilipom13
dilipom13 requested a review from ellatrix as a code owner September 12, 2026 11:16
@github-actions

Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dilipom13 <dilip2615@git.wordpress.org>
Co-authored-by: sirreal <jonsurrell@git.wordpress.org>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@github-actions github-actions Bot added the [Package] Block editor /packages/block-editor label Sep 12, 2026
@dilipom13

Copy link
Copy Markdown
Contributor Author

Could you please add the [Type] Bug label? I don't have permission to add labels on this repo.

Narrow the shadow-DOM text-field early return so only non-contentEditable inputs and textareas bypass writing-flow handlers. Fixes Prettier formatting and restores block copy/cut/paste E2E coverage.
@t-hamano t-hamano added [Type] Bug An existing feature does not function as intended [Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... labels Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Writing Flow Block selection, navigation, splitting, merging, deletion... [Package] Block editor /packages/block-editor [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Editor keyboard/clipboard handlers misfire for editable elements inside shadow DOM

2 participants