[PR #339] [CLOSED] fix(ui): prevent chat folder glitch during expand/collapse transition and reorder #4566

Closed
opened 2026-10-22 04:08:48 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/339
Author: @ghost
Created: 5/1/2026
Status: ❌ Closed

Base: main ← Head: chat_folder_transition


📝 Commits (8)

  • 4f517ff fix(ui): prevent chat folder glitch during expand/collapse transition
  • e63e4bf fix(chat-sidebar): prevent text selection on folder name during drag
  • fe2d9da fix(chat-sidebar): refine folder header click areas for expand/collapse
  • 626a50e fix(caht-sidebar): Restore keyboard access for folder expand/collapse
  • e10214c fix(chat-sidebar): folder action buttons visible on keyboard focus.
  • 602b0bf fix(chat-sidebar): reveal folder action buttons on keyboard focus
  • 10c1799 fix(chat-sidebar): add aria-expanded to folder name and count for screen readers
  • f3dff3e fix(chat-sidebar): wrap entire folder in Reorder.Item so header and contents drag together

📊 Changes

1 file changed (+65 additions, -24 deletions)

View changed files

📝 packages/client/src/components/layout/ChatSidebar.tsx (+65 -24)

📄 Description

Why this change

Fix three distinct issues with chat sidebar folders: (1) a visual glitch during expand/collapse, (2) unintended text selection during drag-to-reorder, and (3) blank spaces triggering unwanted folder expand/collapse.

What changed

Glitch Issue

  • Refactored FolderRow to separate concerns between drag-to-reorder and expand/collapse:
    • Reorder.Item now wraps only the folder header row (the draggable part)
    • Folder contents (chat entries) are rendered outside Reorder.Item as a plain conditional render
  • Added sliding transition animation for folder expand/collapse using AnimatePresence + motion.div:
    • Enter/exit animation: y: -8 → 0, opacity: 0 → 1, height: 0 → auto
    • Duration: 0.25s with easing [0.16, 1, 0.3, 1] (matching project's message-in animation)
    • overflow-hidden on the container to clip content during height animation
    • mode="wait" on AnimatePresence to prevent exit animation interruption on rapid toggling

Drag/Reorder Issue

  • Added select-none utility class to the grip handle div to prevent text selection when initiating a drag

Chat Folder Click Area Issue

  • Restructured folder header to isolate click targets:
    • Grip handle uses onPointerDown to start drag, onClick with stopPropagation to prevent toggle
    • Chevron and color dot wrapped in a dedicated div with explicit toggle handler
    • Blank space between grip and chevron, and to the left of grip, now has no click handler (inert)
  • Added keyboard accessibility to folder toggle:
    • Folder name span and count badge gained role="button", tabIndex={0}, and onKeyDown handler for Enter/Space
  • Revealed folder action buttons on keyboard focus:
    • Parent header container gains focus-within background on any child focus
    • Rename/delete buttons gain group-focus-within:opacity-100 and focus-visible:opacity-100

Validation

  • pnpm check passes locally
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport)

Manual verification

Glitch Issue

  1. Open the chat sidebar
  2. Expand/collapse a folder with multiple entries
  3. Verify header row stays stable and contents slide smoothly

Drag/Reorder Issue

  1. Drag a folder to reorder
  2. Verify folder name text is not selected during drag
  3. Selecting a folder name, e.g copying the folder name
  4. Verify text can still be selected normally

Chat Folder Click Area Issue

  1. Click the blank space around grip icon
  2. Verify its not triggering folder expand/collapse
  3. Clicking the arrow, color dot, folder name, verify folder expands/collapses
  4. Tab to a folder, verify rename/delete buttons are visible during keyboard focus
  5. Press Enter or Space on a focused folder element, verify folder expands/collapses

Logs, screenshots, or video

FIxed Glitch

https://github.com/user-attachments/assets/568c3a45-ef0e-4d94-9f69-f5b7b8cd626f

Fixed Drag/Reorder

https://github.com/user-attachments/assets/a89a674c-2e86-4cb1-844c-c4284a0c3cfd

Summary by CodeRabbit

  • Bug Fixes

    • Prevented accidental drag vs. click conflicts by confining drag initiation to the grip and isolating header click targets; click and keyboard activation now reliably toggle folders.
  • New Features

    • Folder expand/collapse now uses smooth enter/exit animations (height, fade, and slight vertical motion) for a more polished experience.
    • Multiple header elements (chevron, color dot, name, item count) each independently toggle collapse via mouse and keyboard.
  • Style

    • Improved focus and visual feedback for header controls and action buttons for clearer interaction cues.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/339 **Author:** [@ghost](https://github.com/ghost) **Created:** 5/1/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `chat_folder_transition` --- ### 📝 Commits (8) - [`4f517ff`](https://github.com/Pasta-Devs/Marinara-Engine/commit/4f517ff17b06296dc0d6ac0632645686ad2af4fb) fix(ui): prevent chat folder glitch during expand/collapse transition - [`e63e4bf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e63e4bf7c7e18dc1f2801d330329b5754f4f2a57) fix(chat-sidebar): prevent text selection on folder name during drag - [`fe2d9da`](https://github.com/Pasta-Devs/Marinara-Engine/commit/fe2d9dae2ea9121cadf95600abca989f10013e31) fix(chat-sidebar): refine folder header click areas for expand/collapse - [`626a50e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/626a50e31a4a20fe4c15ac92c97f8b921727f1dc) fix(caht-sidebar): Restore keyboard access for folder expand/collapse - [`e10214c`](https://github.com/Pasta-Devs/Marinara-Engine/commit/e10214cfb1aabf1514a371091c15e24dab9c0588) fix(chat-sidebar): folder action buttons visible on keyboard focus. - [`602b0bf`](https://github.com/Pasta-Devs/Marinara-Engine/commit/602b0bfa26e3ef2d18e22891356b1ef05034e7e0) fix(chat-sidebar): reveal folder action buttons on keyboard focus - [`10c1799`](https://github.com/Pasta-Devs/Marinara-Engine/commit/10c1799dc86d09ba231ac4911fd8e759f448e59a) fix(chat-sidebar): add aria-expanded to folder name and count for screen readers - [`f3dff3e`](https://github.com/Pasta-Devs/Marinara-Engine/commit/f3dff3ebc896468d6fa26a6fd41058691d930adf) fix(chat-sidebar): wrap entire folder in Reorder.Item so header and contents drag together ### 📊 Changes **1 file changed** (+65 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `packages/client/src/components/layout/ChatSidebar.tsx` (+65 -24) </details> ### 📄 Description ## Why this change Fix three distinct issues with chat sidebar folders: (1) a visual glitch during expand/collapse, (2) unintended text selection during drag-to-reorder, and (3) blank spaces triggering unwanted folder expand/collapse. ## What changed ### Glitch Issue - Refactored `FolderRow` to separate concerns between drag-to-reorder and expand/collapse: - `Reorder.Item` now wraps only the folder header row (the draggable part) - Folder contents (chat entries) are rendered outside `Reorder.Item` as a plain conditional render - Added sliding transition animation for folder expand/collapse using `AnimatePresence` + `motion.div`: - Enter/exit animation: `y: -8 → 0`, `opacity: 0 → 1`, `height: 0 → auto` - Duration: `0.25s` with easing `[0.16, 1, 0.3, 1]` (matching project's `message-in` animation) - `overflow-hidden` on the container to clip content during height animation - `mode="wait"` on `AnimatePresence` to prevent exit animation interruption on rapid toggling ### Drag/Reorder Issue - Added `select-none` utility class to the grip handle div to prevent text selection when initiating a drag ### Chat Folder Click Area Issue - Restructured folder header to isolate click targets: - Grip handle uses `onPointerDown` to start drag, `onClick` with `stopPropagation` to prevent toggle - Chevron and color dot wrapped in a dedicated div with explicit toggle handler - Blank space between grip and chevron, and to the left of grip, now has no click handler (inert) - Added keyboard accessibility to folder toggle: - Folder name span and count badge gained `role="button"`, `tabIndex={0}`, and `onKeyDown` handler for Enter/Space - Revealed folder action buttons on keyboard focus: - Parent header container gains `focus-within` background on any child focus - Rename/delete buttons gain `group-focus-within:opacity-100` and `focus-visible:opacity-100` ## Validation - [x] pnpm check passes locally - [x] Ran the app, clicked through the changes manually - [x] Checked edge cases (light + dark mode, mobile viewport) ## Manual verification ### Glitch Issue 1. Open the chat sidebar 2. Expand/collapse a folder with multiple entries 3. Verify header row stays stable and contents slide smoothly ### Drag/Reorder Issue 1. Drag a folder to reorder 2. Verify folder name text is not selected during drag 3. Selecting a folder name, e.g copying the folder name 4. Verify text can still be selected normally ### Chat Folder Click Area Issue 1. Click the blank space around grip icon 2. Verify its not triggering folder expand/collapse 5. Clicking the arrow, color dot, folder name, verify folder expands/collapses 6. Tab to a folder, verify rename/delete buttons are visible during keyboard focus 7. Press Enter or Space on a focused folder element, verify folder expands/collapses ## Logs, screenshots, or video ### FIxed Glitch https://github.com/user-attachments/assets/568c3a45-ef0e-4d94-9f69-f5b7b8cd626f ### Fixed Drag/Reorder https://github.com/user-attachments/assets/a89a674c-2e86-4cb1-844c-c4284a0c3cfd <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Prevented accidental drag vs. click conflicts by confining drag initiation to the grip and isolating header click targets; click and keyboard activation now reliably toggle folders. * **New Features** * Folder expand/collapse now uses smooth enter/exit animations (height, fade, and slight vertical motion) for a more polished experience. * Multiple header elements (chevron, color dot, name, item count) each independently toggle collapse via mouse and keyboard. * **Style** * Improved focus and visual feedback for header controls and action buttons for clearer interaction cues. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-22 04:08:48 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#4566
No description provided.