Skip to content

feat(bulk-editor): shift+click range selection and animated notices banner - #23511

Open
vraja-pro wants to merge 3 commits into
feature/bulk-editor-ph2from
3075-bulk-editor-checkbox-improvments
Open

feat(bulk-editor): shift+click range selection and animated notices banner#23511
vraja-pro wants to merge 3 commits into
feature/bulk-editor-ph2from
3075-bulk-editor-checkbox-improvments

Conversation

@vraja-pro

Copy link
Copy Markdown
Contributor

Context

Three UX improvements for the bulk editor selection and AI notice flow:

  1. Shift+click range selection — clicking a checkbox while holding Shift selects all rows between the last plain-clicked row and the current one, matching standard multi-select table patterns.
  2. Animated notices banner — the Premium missing-keyphrase banner now slides in/out smoothly instead of causing a layout jump inside the already-expanded bulk-actions band.
  3. Deselected row marker cleanup — when a row is deselected, its blue info icon (missing-keyphrase marker) is cleared immediately so it doesn't linger after the row is opted out of the generation batch. (The marker-clearing logic lives in Premium; this PR provides the selectRange action and the shiftKey plumbing that the cleanup depends on.)

Summary

This PR can be summarized in the following changelog entry:

  • Non-user-facing: Add shift+click range selection to the bulk editor, animate the AI notices banner slide-in, and wire shiftKey through the row-toggle seam.

Relevant technical choices:

  • selectRange reducer added to selection.js — merges the contiguous id range (anchorId → targetId within the ordered editable-item list) into the existing selection without replacing it.
  • BulkEditorContent tracks anchorIdRef and wraps toggleRow: a plain click updates the anchor; a shift+click dispatches selectRange. The anchor is cleared on selectAll / deselectAll.
  • handleToggle in BulkEditorRow passes event.shiftKey as a second arg so the shift state flows through the row-toggle seam without coupling the row to the range logic.
  • BulkActionsNotices is wrapped in AnimateHeight driven by useSlotFills(BULK_NOTICES_SLOT): the notices section expands/collapses smoothly when Premium mounts or unmounts its fill.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

  • Open the bulk editor with multiple posts.
  • Click a checkbox on one row (plain click) — it should select.
  • Shift+click a checkbox several rows below — all rows in between should be selected.
  • Click "Select all" then "Deselect all" — anchor should reset (next shift+click should start a new range from the next plain click).
  • With Premium active, run an AI generation that skips posts without a focus keyphrase. Observe the banner sliding in smoothly (no layout jump). Dismiss it and confirm it slides out.

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

  • Same steps as above.

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • Bulk editor selection logic (selection.js, bulk-editor-content.js, table-row.js)
  • Bulk editor notices band animation (bulk-action-bar.js)

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.
  • This PR also affects Yoast SEO for Google Docs. I have added a changelog entry starting with [yoast-doc-extension], added test instructions for Yoast SEO for Google Docs and attached the Google Docs Add-on label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.
  • I have run grunt build:images and commited the results, if my PR introduces new images or SVGs.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Related: https://github.com/Yoast/plugins-automated-testing/issues/3075

…anner

- selection.js: add selectRange reducer that merges a contiguous id range
  (anchorId → targetId within the editable id list) into the current selection
- bulk-editor-content.js: track anchorId ref; wrap toggleRow so plain clicks
  set the anchor and shift+clicks dispatch selectRange; clear anchor on
  selectAll/deselectAll
- table-row.js: pass event.shiftKey as second arg to onToggleRow so the
  checkbox onChange event reaches the range-selection logic
- bulk-action-bar.js: wrap BulkActionsNotices in AnimateHeight driven by
  useSlotFills, so the Premium notice banner slides in/out smoothly instead
  of causing a layout jump

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coveralls-official

coveralls-official Bot commented Jul 27, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 0

Coverage increased (+0.001%) to 55.56%

Details

  • Coverage increased (+0.001%) from the base build.
  • Patch coverage: 13 uncovered changes across 1 file (29 of 42 lines covered, 69.05%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
packages/js/src/bulk-editor/components/bulk-editor-content.js 30 17 56.67%
Total (3 files) 42 29 69.05%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 72954
Covered Lines: 40440
Line Coverage: 55.43%
Relevant Branches: 18927
Covered Branches: 10609
Branch Coverage: 56.05%
Branches in Coverage %: Yes
Coverage Strength: 41253.23 hits per line

💛 - Coveralls

…tion

onChange on a checkbox does not carry modifier-key info, so reading
event.shiftKey there is unreliable (always undefined on Mac/Chrome).
Replace the event-argument approach with document keydown/keyup listeners
that keep isShiftDownRef in sync; onToggleRow reads that ref instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vraja-pro vraja-pro added the changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog label Jul 27, 2026
@vraja-pro vraja-pro added this to the feature/bulk-editor-ph2 milestone Jul 27, 2026
@vraja-pro
vraja-pro requested a review from Copilot July 27, 2026 15:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves the Bulk Editor UX by adding shift+click range selection for row checkboxes and animating the Bulk Actions notices area so banners appear/disappear without layout jumps.

Changes:

  • Add a selectRange action to merge a contiguous id range into the existing selection.
  • Track an “anchor” row in BulkEditorContent to support shift+click range selection, and reset the anchor on select-all/deselect-all.
  • Wrap the bulk notices region in AnimateHeight, expanding/collapsing based on whether notices are present.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/js/src/bulk-editor/store/selection.js Adds selectRange reducer to support shift+click range selection.
packages/js/src/bulk-editor/components/bulk-editor-content.js Implements anchor-based range selection and updates select-all/deselect-all handling.
packages/js/src/bulk-editor/components/bulk-action-bar.js Animates notices/banner region via AnimateHeight and slot-fill detection.
Comments suppressed due to low confidence (2)

packages/js/src/bulk-editor/components/bulk-editor-content.js:153

  • The Shift key tracking can get stuck as true if the window loses focus while Shift is held (no keyup fires), which would make subsequent plain clicks behave like shift+click. Consider resetting isShiftDownRef on window.blur (and/or visibilitychange) to keep the modifier state consistent.
		document.addEventListener( "keydown", onDown );
		document.addEventListener( "keyup", onUp );
		return () => {
			document.removeEventListener( "keydown", onDown );
			document.removeEventListener( "keyup", onUp );

packages/js/src/bulk-editor/components/bulk-editor-content.js:161

  • Shift+click range selection is introduced here, but there are no unit tests covering the anchor + range behavior (including anchor reset on selectAll/deselectAll). Since bulk-editor-content.test.js already exists, adding a focused test for dispatching selectRange on shift+click would protect this UX behavior.
	const onToggleRow = useCallback( ( id ) => {
		if ( isShiftDownRef.current && anchorIdRef.current !== null ) {
			const allEditableIds = items.filter( ( item ) => item.editable ).map( ( item ) => item.id );
			selectRange( { anchorId: anchorIdRef.current, targetId: id, allIds: allEditableIds } );
		} else {

Comment on lines +135 to +137
// Tracks whether the Shift key is currently held, via document events — onChange on a checkbox
// doesn't carry modifier-key info, so we can't rely on event.shiftKey there.
const isShiftDownRef = useRef( false );
Comment on lines +28 to +33
/**
* Merges a contiguous range of ids (from anchorId to targetId within allIds) into the current selection.
*/
selectRange: ( state, { payload: { anchorId, targetId, allIds } } ) => {
const anchorIndex = allIds.indexOf( anchorId );
const targetIndex = allIds.indexOf( targetId );
- Reset isShiftDownRef on window blur so holding Shift while switching
  windows (Alt+Tab) doesn't leave the ref stuck, causing the next plain
  click to behave as a shift+click.
- Add unit tests for the selectRange reducer: forward range, reverse
  range, merge with existing selection, and no-op on unknown anchor/target.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: non-user-facing Needs to be included in the 'Non-userfacing' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants