fix(selection): keep shift selection item visible#3920
Conversation
BundleMonUnchanged files (20)
Total files change +1B 0% Groups updated (1)
Unchanged groups (2)
Final result: ✅ View report in BundleMon website ➡️ |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
WalkthroughA new Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/modules/selection/scrollHelpers.ts (1)
11-29: 💤 Low valueConsider documenting the vertical-only scroll behavior.
The function only handles vertical scrolling (top/bottom overflow) but does not address horizontal scrolling (left/right overflow). If this is intentional for the current use case (vertical lists), consider adding a JSDoc comment to clarify this constraint.
📝 Proposed documentation addition
+/** + * Scrolls a container to bring an element fully into view vertically. + * Only handles vertical overflow; horizontal scrolling is not implemented. + * + * `@param` container - The scrollable container element + * `@param` element - The element to scroll into view + */ const scrollElementIntoViewInContainer = ( container: HTMLElement, element: Element ): void => {🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/modules/selection/scrollHelpers.ts` around lines 11 - 29, Add JSDoc documentation to the scrollElementIntoViewInContainer function to clarify that it only handles vertical scrolling behavior (top and bottom overflow). The comment should explicitly note that horizontal scrolling (left and right overflow) is not currently implemented, making the intentional scope of this function clear to other developers who may use it or maintain it in the future.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/modules/selection/scrollHelpers.ts`:
- Around line 3-9: The scrollContainerByDirection function accesses direction[0]
and direction[1] without validating that the direction array has at least 2
elements, which will result in undefined values and cause scrollBy to receive
NaN arguments. Add validation at the start of the function to check that
direction.length is at least 2, and either throw an error with a descriptive
message or return early if the validation fails.
---
Nitpick comments:
In `@src/modules/selection/scrollHelpers.ts`:
- Around line 11-29: Add JSDoc documentation to the
scrollElementIntoViewInContainer function to clarify that it only handles
vertical scrolling behavior (top and bottom overflow). The comment should
explicitly note that horizontal scrolling (left and right overflow) is not
currently implemented, making the intentional scope of this function clear to
other developers who may use it or maintain it in the future.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: c2d8dc97-faf0-44b8-82d7-3d6cd4ddb7ef
📒 Files selected for processing (5)
src/hooks/useShiftSelection/index.spec.tsxsrc/hooks/useShiftSelection/index.tsxsrc/modules/selection/RectangularSelection.jsxsrc/modules/selection/scrollHelpers.tssrc/modules/views/Folder/virtualized/FolderViewBodyContent.jsx
617ea25 to
f97f290
Compare
Share DOM scroll helpers between rectangular selection and keyboard range selection. Use the actual scroll container to reveal the current item when extending a selection with Shift+Arrow.
…ion arrays scrollBy received NaN arguments when the direction array had fewer than two elements, since direction[0] and direction[1] were accessed without a length check. Return early instead.
f97f290 to
e61131f
Compare
There was a problem hiding this comment.
Our agent can fix these. Install it.
Gates Passed
3 Quality Gates Passed
Quality Gate Profile: The Bare Minimum
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
Share DOM scroll helpers between rectangular selection and keyboard range selection. Use the actual scroll container to reveal the current item when extending a selection with Shift+Arrow.
Capture.video.du.2026-06-15.17-28-11.webm
https://app.notion.com/p/linagora/Add-scroll-when-use-Shift-arrow-to-select-37c62718bad18053823dec07e36bf911
Summary by CodeRabbit
New Features
Tests