Repository navigation
E2E: Add regression test for multi-block Rich Text tabindex - #78073
ntsekouras merged 3 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 6 remain after this review. 📝 WalkthroughWalkthroughAdds an end-to-end regression test for multi-selected paragraph blocks. The test checks ChangesMulti-block selection
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to This adds regression coverage for multi-block selection copy, delete, and paste behavior without changing product runtime code. No current merge-readiness risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
| // block ends up copied, with a possible React reconciliation error). | ||
| // This test MUST fail if the `tabIndex` override in | ||
| // packages/block-editor/src/components/rich-text/index.js is removed. | ||
| test( 'should not assign tabindex to Rich Text within multi-selected blocks', async ( { |
There was a problem hiding this comment.
I don't think these were the steps of #53774. That issue was about a partial selection of paragraphs? Pressing cmd+a will trigger a "full" selection (whole blocks colored, vs a text selection. Also this test seems to do a copy instead of a cut.
There was a problem hiding this comment.
@ellatrix I updated it to use a partial selection of paragraphs. I didn't add the cut since partial cut is already covered in copy-cut-paste.spec.js. The tabindex check is what fails if this regresses. What do you think?
There was a problem hiding this comment.
I think that's testing implementation details. We should test the steps in the original issue. I pushed a change, how does that look?
Adds an e2e test that asserts Rich Text elements inside multi-selected blocks do not carry a `tabindex` attribute. Without the `tabIndex` override in `packages/block-editor/src/components/rich-text/index.js`, browsers (Safari especially) move focus to a Rich Text on shift-click or right-click into a multi-selected block, which routes copy/cut events to the single-block Rich Text handler instead of the global multi-block one — only one block ends up copied, sometimes with a React reconciliation error. Verifies WordPress#53774 stays fixed; the test was confirmed to fail when the `tabIndex` override is reverted, then pass again with it restored. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
e1066b4 to
b56dd01
Compare
🤖 PR meta 🤖🎉 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 |
…ction Follow the steps of WordPress#53774: a partial selection of paragraphs instead of a full Cmd+A selection. Drop the copy and paste round trip, which passes even with the tabindex restored because keyboard shortcuts never move focus, and point the comment at the current rich-text/index.tsx lines. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
b56dd01 to
4dcd6c5
Compare
The bug in WordPress#53774 needs a right-click: it moved focus or the selection before Cut ran. Without the right-click, cut works even when the fix is removed. Check the cut result instead of the `tabindex` attribute. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
What?
Adds an end-to-end regression test in
test/e2e/specs/editor/various/multi-block-selection.spec.jsthat asserts Rich Text elements inside multi-selected blocks do not carry atabindexattribute.Verifies that #53774 stays fixed.
Why?
Per @ellatrix's request in #53774, the original fix was an "accidental" side effect of #53440 (and earlier discussion in #53799), so an e2e test guards against accidental regression.
The bug, in short: Rich Text elements inside multi-selected blocks used to have
tabindex="0". Browsers (Safari especially) would move focus to a Rich Text element on shift-click or right-click into a multi-selected block. Once focus landed on the Rich Text,cut/copyevents were handled by the single-block Rich Text handler instead of the global multi-block handler — only one block ended up copied, sometimes with aFailed to execute 'insertBefore' on 'Node'React reconciliation error.The fix removes
tabIndexfrom contentEditable Rich Text inpackages/block-editor/src/components/rich-text/index.js.How?
The test:
Ctrl/Cmd+Atwice.Block: Paragraphelement has notabindexattribute.The test was confirmed to fail when the
tabIndexoverride inrich-text/index.jsis reverted, and pass with the override in place — across Chromium, Firefox, and WebKit.Testing Instructions
npm run wp-env-test -- start npm run test:e2e -- test/e2e/specs/editor/various/multi-block-selection.spec.js --grep "should not assign tabindex"Expected: 3 passed (chromium, firefox, webkit).
To verify the test catches regressions, temporarily replace the
tabIndexblock inpackages/block-editor/src/components/rich-text/index.jswithtabIndex={ props.tabIndex }, rebuild (npm run build), and re-run — the test should fail with<p tabindex="0" ... is-multi-selected>.Testing Instructions for Keyboard
No UI changes; this PR only adds an automated test.
Summary by CodeRabbit
tabindex.