Repository navigation
Block Editor: Check supported bindings when copying selected text - #84389
salvatorecorsi wants to merge 10 commits into
Conversation
🤖 PR meta 🤖👋 Welcome👋 Thanks for your first Pull Request and for helping build the future of Gutenberg and WordPress, @salvatorecorsi! In case you missed it, we'd love to have you join us in our Slack community. If you want to learn more about WordPress development in general, check out the Core Handbook full of helpful information. 🎉 PropsIf you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
Updated as activity occurs, without notifying anyone named here. Add the 🏷️ LabelsThis pull request needs exactly one label indicating its type, and has 0.
Read more about Type labels in Gutenberg. If you cannot add labels yourself, a reviewer can do it for you. |
Retain supported binding and pattern override handling in the upstream clipboard path. Migrate the regression tests to TypeScript and the current RichText event delegation API. Validated production build, full typecheck, 296 focused tests, Vitest conventions, and scoped lint-staged checks.
|
Merged trunk at Superseded CI follow-upCould a maintainer rerun Chromium shard 2? On the current head ( Earlier CI follow-up on superseded headsA changelog-only follow-up at Earlier CI follow-up on the previous headCould a maintainer rerun the Chromium job? It stops with |
What?
Restrict the bound-text clipboard exception to bindings supported by the selected attribute, and resolve pattern override defaults with the existing binding utility.
The general fully selected bound-text copy path from #84362 is now in trunk. This PR retains the supported-attribute and pattern-default guard, plus regression coverage for that path.
Why?
A binding on another attribute, an unsupported selected attribute, or a non-pattern default should not bypass whole-block serialization. Otherwise copying can discard the block wrapper and binding metadata even though the selected text is not a supported bound field.
How?
Read the block's supported binding attributes, normalize pattern override defaults, and use the RichText copy path only when the selected attribute has a supported binding. Preserve trunk's clipboard and iframe changes.
Testing Instructions
Validation after the trunk merge (2026-10-16)
Merged trunk at
6b45881480c272953c52090a686b0b8ca679c051with a normal merge, retaining the upstream and PR changelog entries. The fully selected bound-text copy correction remains unchanged, and upstream's paste-handling improvements are preserved.npm run buildpassed (298 seconds).npm run test:unit -- packages/block-editor --project=node --project=jsdompassed: 145 files, 2,324 tests, including the bound-text clipboard regressions.npm run typecheckpassed.npm run test:unit:conventionspassed.npm exec --no -- lint-staged --concurrent false --diff=6b45881480c272953c52090a686b0b8ca679c051passed, including formatting, prelint, ESLint, and generated-documentation consistency checks; the checked tree was preserved.npm run lint:changelogs -- --require-pr=84389 packages/block-editor/CHANGELOG.mdpassed.The two copy E2E cases were not rerun locally during this merge update because the Docker
wp-envenvironment is unavailable. CI for the updated merge revision is pending.Testing Instructions for Keyboard
For a single-line bound paragraph, place the caret in its text. On Windows/Linux, use Home followed by Shift+End; on macOS, use Cmd+Left followed by Cmd+Shift+Right. Copy with Ctrl+C or Cmd+C, paste into a plain-text field, and verify the complete phrase. With a collapsed text selection, copy/paste the block within the editor and verify its binding is preserved.
The keyboard-only sequence has not been manually verified locally.
Could a maintainer add the
[Type] Buglabel? I do not have permission to apply upstream labels.Validation update — 9 November 2026
Merged trunk
c8e6627f9d4575b27cb95887c538b4c95817c20eand validated published head99ff73534ccf0bf4e3ba8549fba04b086bb165cf. This includes the required trunk baseline.These are local validation results; hosted CI and maintainer-only label requirements remain separate.
The final follow-up changes only the changelog to describe the supported-binding/pattern-default guard that remains beyond trunk. Production and test files are byte-identical to
1d87ee6343e7d38e93bfa7e58c86f439ec2c2991, so its full build, typecheck and 3,281 passing cases are retained; the actual final changelog passed the repository changelog validator and diff checks.Validation update — 20 November 2026
Resolved the actual conflicts by merging trunk
3c872fce8cff38d2a8d38cd48a62575895114fb8normally. Published head:e5ef2d0af2a8891f890117a07e68991a3c1f8963.The PR's own source and regression-test blobs are unchanged; upstream release notes are preserved and this PR's changelog entries remain under Unreleased.
These are local branch-update results. Hosted CI is tracked separately; no full Docker E2E or published-dependency audit is claimed for this update.
Use of AI Tools
OpenAI Codex generated the implementation, regression tests, and this description. Codex also performed the current merge-maintenance source review and automated validation listed above. The contributor remains responsible for reviewing the generated work, and the change requires maintainer review.