Skip to content

fix(web): fix sidebar project drag clipping with variable-height items#1176

Merged
juliusmarminge merged 1 commit intopingdotgg:mainfrom
GuilhermeVieiraDev:fix/sidebar-project-drag-clipping
Mar 17, 2026
Merged

fix(web): fix sidebar project drag clipping with variable-height items#1176
juliusmarminge merged 1 commit intopingdotgg:mainfrom
GuilhermeVieiraDev:fix/sidebar-project-drag-clipping

Conversation

@GuilhermeVieiraDev
Copy link
Copy Markdown
Contributor

@GuilhermeVieiraDev GuilhermeVieiraDev commented Mar 17, 2026

What Changed

Replaced restrictToParentElement with restrictToFirstScrollableAncestor in the sidebar project drag-and-drop modifiers.

Why

When dragging a project with many expanded threads toward the bottom of the list, the dragged item gets visually clipped if it's taller than the project below it. This happens because restrictToParentElement constrains the entire dragged element within the parent element's bounds, which doesn't leave enough room for tall items to reach the last position.

This is a known dnd-kit issue with variable-height sortable items. restrictToFirstScrollableAncestor constrains to the sidebar's ScrollArea viewport instead, which gives enough room for tall items while still keeping the drag bounded.

Note: The dragged item can now move slightly above the "PROJECTS" header and into the empty space below the list. This is a minor cosmetic tradeoff, happy to tighten it with a custom modifier if preferred.

UI Changes

Before:

Screencast.From.2026-03-17.22-10-02.mp4

After:

Screencast.From.2026-03-17.22-10-54.mp4

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes

Note

Fix sidebar project drag clipping by switching to restrictToFirstScrollableAncestor

The drag modifier in Sidebar.tsx is changed from restrictToParentElement to restrictToFirstScrollableAncestor, fixing visual clipping when dragging variable-height items in the projects list. The vertical axis constraint is unchanged.

Macroscope summarized f62ef92.

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 17, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: e2b86647-a111-4c49-bf7d-af7376d8ec6d

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Tip

CodeRabbit can generate a title for your PR based on the changes with custom instructions.

Set the reviews.auto_title_instructions setting to generate a title for your PR based on the changes in the PR with custom instructions.

@github-actions github-actions bot added size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list. labels Mar 17, 2026
@GuilhermeVieiraDev
Copy link
Copy Markdown
Contributor Author

Small note: with this change the dragged item can move slightly above the projects header and into the empty space below the list. Happy to tighten it with a custom modifier if that's a concern.

@juliusmarminge juliusmarminge merged commit 9ee8c4f into pingdotgg:main Mar 17, 2026
9 of 10 checks passed
gabrielMalonso pushed a commit to gabrielMalonso/t3code that referenced this pull request Mar 19, 2026
apexsloth pushed a commit to apexslothforks/t3code that referenced this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XS 0-9 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants