Skip to content

[8824] Improve shared content browse dialog selection UX - #8840

Open
jvega190 wants to merge 12 commits into
craftersoftware:developfrom
jvega190:enhancement/8824
Open

[8824] Improve shared content browse dialog selection UX#8840
jvega190 wants to merge 12 commits into
craftersoftware:developfrom
jvega190:enhancement/8824

Conversation

@jvega190

@jvega190 jvega190 commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

#8824

Summary by CodeRabbit

  • New Features
    • Added a resizable folder tree panel in the Browse Files dialog (drawer-style layout with adjustable width).
  • Bug Fixes
    • Improved folder-tree node selection so clicked paths resolve correctly and keep folder/page/media selection in sync for both single- and multi-select, with special handling for leaf pages.
    • Prevented redundant child-loading and improved error recovery during tree expansion.
  • UI Improvements
    • Enhanced active-path highlighting with themeable “activeItem” styling across the path navigator.
    • Updated empty-state messaging to show “This item has no children.” when the current selection is a leaf page.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The browse dialog now resolves tree clicks to content items, synchronizes leaf-page selection and highlighting, conditionally reports empty folders, loads tree children with duplicate-fetch guards, propagates active-item styling, and supports bounded resizing of the folder tree panel.

Changes

Browse dialog tree selection

Layer / File(s) Summary
Leaf-page selection synchronization
studio-ui/ui/app/src/components/BrowseFilesDialog/*
Tree clicks resolve ContentItem data, update leaf-page selection and multi-select state, propagate highlighted paths, and distinguish leaf-page empty states.
Tree expansion and active-item styling
studio-ui/ui/app/src/components/FolderBrowserTreeView/*, studio-ui/ui/app/src/components/PathNavigatorTree/*
Tree initialization and node clicks dispatch child expansion or fetching with duplicate-fetch guards, while active-item style overrides propagate through nested tree nodes.
Resizable folder tree panel
studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx
The tree sidebar becomes a bounded resizable drawer, shifts the main content with its width, and displays leaf-specific empty-state text.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PathNavigatorTree
  participant FolderBrowserTreeView
  participant BrowseFilesDialogContainer
  participant BrowseFilesDialogUI
  PathNavigatorTree->>FolderBrowserTreeView: click path
  FolderBrowserTreeView->>BrowseFilesDialogContainer: pass selected path
  BrowseFilesDialogContainer->>BrowseFilesDialogContainer: resolve ContentItem and leaf-page MediaItem
  BrowseFilesDialogContainer->>BrowseFilesDialogUI: pass treeSelectedPath and isCurrentPathLeaf
  BrowseFilesDialogUI->>PathNavigatorTree: apply highlighted path and active-item styling
Loading

Possibly related issues

Suggested reviewers: jmendeza

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: improving shared content browse dialog selection UX.
Description check ✅ Passed The description includes the required ticket reference link and satisfies the repository template.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 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 `@studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx`:
- Around line 119-128: Update handleTreePanelResizeMouseDown to use a shared
cleanup function that removes both document listeners and deactivates resizing.
Invoke this cleanup on mouseup, from a useEffect unmount cleanup, and on window
blur; ensure the blur listener is also removed during effect cleanup and
preserve the existing handleTreePanelMouseMove dependency.
- Around line 162-191: Update the resize separator Box using
handleTreePanelResizeMouseDown’s associated panel sizing state to add a tab
stop, handle ArrowLeft and ArrowRight keyboard adjustments, and expose
aria-valuemin, aria-valuemax, and aria-valuenow reflecting the folder panel
width. Preserve the existing mouse resizing and visual behavior.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9e9bedd7-9a0f-4348-aca3-d7c2fb290188

📥 Commits

Reviewing files that changed from the base of the PR and between 00ade1d and fb6db8e.

📒 Files selected for processing (4)
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogContainer.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts
  • studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx

Comment thread studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx Outdated
Comment thread studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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
`@studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx`:
- Around line 80-105: Add an in-flight per-path guard to the handleNodeClick
flow so repeated clicks cannot dispatch duplicate
pathNavigatorTreeFetchPathChildren requests before the first one completes.
Track pending child-fetch paths using the existing tree state or an appropriate
request-status mechanism, check it before dispatching, and clear it when the
fetch resolves or fails; preserve the current expand behavior for already-loaded
children.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 97d0f1f8-ab8e-4889-b79f-4683403dbd5d

📥 Commits

Reviewing files that changed from the base of the PR and between a42884c and f6307e9.

📒 Files selected for processing (4)
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogContainer.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts
  • studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx
🚧 Files skipped from review as they are similar to previous changes (3)
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogContainer.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx

@jvega190

Copy link
Copy Markdown
Contributor Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

@jvega190 Absolutely — I’ll perform a final comprehensive review of #8840, with particular attention to selection behavior, tree loading state, cleanup, and keyboard resizing accessibility before handoff.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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
`@studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogContainer.tsx`:
- Around line 96-97: Update the selected-path lookup near isCurrentPathLeaf to
use lookupItemByPath instead of directly indexing itemsByPath, ensuring both
/site/website and /site/website/index.xml variants resolve correctly. Preserve
the existing leaf-selection and deselect behavior after the lookup.

In `@studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx`:
- Around line 475-487: Add an explicit message id to the FormattedMessage
rendering “This item has no children.” within the isCurrentPathLeaf branch of
BrowseFilesDialogUI, following the existing browseFilesDialog naming convention
and preserving its defaultMessage text.

In
`@studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx`:
- Line 47: Update the initialization effect covering the selected-path fetch
chain to consult and register paths in pendingChildFetchPathsRef before
dispatching pathNavigatorTreeFetchPathChildren, matching the guard used by
handleNodeClick. Ensure each path is marked pending before its fetch is
dispatched and skipped while already pending, while preserving existing
loaded-children checks and clearing the pending entry when the request completes
or fails.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 83c88c5c-e5c4-4809-a0dd-d6a7558b4455

📥 Commits

Reviewing files that changed from the base of the PR and between 00ade1d and da4f8f4.

📒 Files selected for processing (7)
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogContainer.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts
  • studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTree.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTreeItem.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTreeUI.tsx

@jvega190

Copy link
Copy Markdown
Contributor Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

@jvega190 I’m running a final comprehensive review of #8840 before human handoff, with attention to selection behavior, tree state/loading, cleanup, and mouse/keyboard resizing accessibility.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

🤖 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
`@studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogContainer.tsx`:
- Around line 203-225: Update the node-selection handling around the page check
and replaceSelectedLookup so plain folder navigation does not clear existing
multi-select entries. Only clear the tree-driven selection when a previously
active tree-selected leaf page exists; preserve manually selected grid items
while navigating between folders, while retaining the existing behavior for
selecting a childless page and single-select mode.

In `@studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx`:
- Around line 139-154: Update handleTreePanelResizeMouseDown to accept the
mousedown event and call preventDefault() before activating the resize
listeners, preventing native text selection during dragging while preserving the
existing cleanup and mouse-move behavior.

In
`@studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx`:
- Around line 105-112: Update the child-fetch guard in the expanded-node logic
around pendingChildFetchPathsRef and tree.errorByPath so an existing error does
not let isExpanded return before scheduling a retry. Preserve the
pending-request deduplication for in-flight fetches, clear the error state as
needed for a retry, and dispatch pathNavigatorTreeFetchPathChildren with expand:
true when the expanded node is clicked again.
🪄 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: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 9626bbc6-29d8-454a-a98b-4344673b9d02

📥 Commits

Reviewing files that changed from the base of the PR and between 00ade1d and 99ee6e0.

📒 Files selected for processing (7)
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogContainer.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts
  • studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTree.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTreeItem.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTreeUI.tsx

Comment thread studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx Outdated
Comment thread studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx Outdated
@jvega190

Copy link
Copy Markdown
Contributor Author

@coderabbitai can you check if everything looks good? Please give it a final review before I hand over for human review

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

@jvega190 I’m running a final comprehensive review of #8840, with focused checks on selection state, tree loading and cleanup, and mouse/keyboard resizing accessibility before human handoff.

✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts (1)

75-81: 🎯 Functional Correctness | 🔵 Trivial | 💤 Low value

Drop the unused item parameter from BrowseFilesDialogUIProps.onPathSelected studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts:80 only the path is ever passed through here, so the extra optional argument is dead API surface.

🤖 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 `@studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts` around lines 75 -
81, Remove the unused optional item parameter from the
BrowseFilesDialogUIProps.onPathSelected callback type, leaving it to accept only
path. Update any corresponding implementations or call sites to match the
path-only signature.
🤖 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.

Nitpick comments:
In `@studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts`:
- Around line 75-81: Remove the unused optional item parameter from the
BrowseFilesDialogUIProps.onPathSelected callback type, leaving it to accept only
path. Update any corresponding implementations or call sites to match the
path-only signature.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 8205bab9-c6d0-431d-a75b-650677dd8391

📥 Commits

Reviewing files that changed from the base of the PR and between 00ade1d and d6a0595.

📒 Files selected for processing (7)
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogContainer.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/BrowseFilesDialogUI.tsx
  • studio-ui/ui/app/src/components/BrowseFilesDialog/utils.ts
  • studio-ui/ui/app/src/components/FolderBrowserTreeView/FolderBrowserTreeView.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTree.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTreeItem.tsx
  • studio-ui/ui/app/src/components/PathNavigatorTree/PathNavigatorTreeUI.tsx

@jvega190
jvega190 marked this pull request as ready for review July 30, 2026 22:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant