List View: Place caret at end of block when selecting#76776
List View: Place caret at end of block when selecting#76776scruffian wants to merge 1 commit intoWordPress:trunkfrom
Conversation
When selecting a block from the List View, the caret is now placed at the end of the block instead of the start. This ensures that pressing Enter after selecting a block creates a new block after the selected block, matching user expectations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
|
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 If 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. |
Mayank-Tripathi32
left a comment
There was a problem hiding this comment.
Works great for me.
Test.Caret.mov
|
Closing in favour of #76797 |
What?
Closes #76774
Places the caret at the end of a block (instead of the start) when selecting a block from the List View panel.
Why?
When selecting a block via List View, the caret was placed at the start of the block. This meant pressing Enter would create a new block before the selected block, which is unexpected. Users expect a new block to be created after the selected block.
How?
Passes
-1as thefocusPositionparameter when selecting a block from the List View (block.js). The value-1tellsuseFocusFirstElementto place the caret at the end of the last text input in the block, rather than the start of the first.Testing Instructions
Testing Instructions for Keyboard
Use of AI Tools
This PR was authored with the assistance of Claude Code (Claude Opus 4.6).