Repository navigation
Administration: Preserve the row selection after Quick Edit. - #16529
umeshnevase wants to merge 1 commit into
Conversation
When a row in a list table is selected and then saved with Quick Edit, the row was replaced with freshly rendered markup, which has an unchecked checkbox. The row ended up unchecked while the "Select all" checkboxes in the table header and footer stayed checked, so a bulk action would skip the edited item. Remember the checked state of the row before it is replaced and restore it on the new row. This applies to the Posts, Pages and custom post types, Tags and Categories (and other taxonomies), and Comments list tables. A new reply to a comment is not selected. Add QUnit tests for `inlineEditPost.save()`, `inlineEditTax.save()` and `commentReply.show()`.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: 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:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
When an item is selected in a list table and then saved with Quick Edit, the row is replaced with freshly rendered markup from the server, and that markup always has an unchecked checkbox. The edited row ends up unchecked while the "Select all" checkboxes in the table header and footer stay checked. A bulk action such as Delete then silently skips the edited item.
This PR remembers the checked state of the row before it is replaced and restores it on the new row, so the row keeps the state it had before Quick Edit.
inline-edit-post.js: covers Posts, Pages and custom post types.inline-edit-tax.js: covers Tags, Categories and other taxonomies.edit-comments.js: covers Comments. This is only done when editing a comment, so a new reply is not selected.Testing
Reproduce on
trunk, then repeat on this branch:wp-admin/edit-tags.php?taxonomy=post_tag). Repeat on Posts → All Posts, Pages, and Comments.I also ran the QUnit suite with the new tests (
npx playwright test --config tests/qunit/playwright.config.js). The new tests fail ontrunkand pass with this change.New QUnit tests cover
inlineEditPost.save(),inlineEditTax.save()andcommentReply.show(): a selected row stays selected, an unselected row stays unselected, partial selection, consecutive saves, a response with no checkbox, failed saves, and (for comments) pending comments and replies.Trac ticket: https://core.trac.wordpress.org/ticket/66945
Use of AI Tools
AI assistance: Yes
Tool(s): Claude Code
Model(s): Claude Sonnet 5.5
Used for: Reproducing the issue, drafting the fix and the QUnit tests, and checking them in the browser. I reviewed the changes and take responsibility for them.
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.