Skip to content

feat(web): add collapsible archived section in session list#489

Open
junmo-kim wants to merge 5 commits intotiann:mainfrom
junmo-kim:feat/archive-collapse
Open

feat(web): add collapsible archived section in session list#489
junmo-kim wants to merge 5 commits intotiann:mainfrom
junmo-kim:feat/archive-collapse

Conversation

@junmo-kim
Copy link
Copy Markdown
Contributor

Summary

When working across multiple machines, archived project groups accumulate
in the sidebar and push active sessions far apart, requiring excessive
scrolling.

  • Within each machine group, archived project groups are now separated
    into a collapsible "Archived (N)" section (default: collapsed)
  • The section only appears when both active and archived groups coexist
    in the same machine — if all groups are archived, no separator is shown
  • Selecting an archived session auto-expands its section

Test plan

  • Open session list with multiple machines, each having active and archived sessions
  • Verify archived groups appear under "Archived (N)" toggle, collapsed by default
  • Click toggle to expand/collapse archived section
  • Select an archived session — verify section auto-expands
  • Verify no section separator when all groups in a machine are archived
  • Keyboard navigation: Tab to archived toggle, Enter/Space to toggle

Within each machine group, archived project groups are now separated
into a collapsible "Archived (N)" section that defaults to collapsed.
This reduces scroll distance when working across multiple machines.

The section only appears when both active and archived groups exist
in the same machine. Selecting an archived session auto-expands the
section.
- Fix stale closure in toggleArchivedSection: read from prev instead
  of render-time state
- Add aria-expanded to archived section toggle button
- Change ProjectGroupItem header from div to button for keyboard
  accessibility
- Add cleanup for stale archivedCollapsed entries when groups change
…ollapse

- Extract groups.find() to a single call at the top of the auto-expand
  effect instead of duplicating it inside setCollapseOverrides and outside
- Add aria-expanded to ProjectGroupItem button for accessibility parity
  with the archived section toggle
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Findings

  • [Major] Nested button in the project-group row introduces invalid interactive markup and an accessibility regression. ProjectGroupItem now renders the entire row as a <button> while still placing CopyPathButton inside it, and CopyPathButton itself renders a <button>. Browsers and assistive tech handle nested buttons inconsistently, so the copy affordance can become unfocusable or trigger the wrong control. Evidence web/src/components/SessionList.tsx:486, web/src/components/SessionList.tsx:497
    Suggested fix:
<div className="group/project sticky top-0 z-10 flex items-center gap-2 px-1 py-1.5 rounded-lg transition-colors hover:bg-[var(--app-subtle-bg)]">
    <button
        type="button"
        className="flex min-w-0 flex-1 items-center gap-2 text-left"
        onClick={onToggle}
        title={group.directory}
        aria-expanded={!isCollapsed}
    >
        <ChevronIcon className="h-3.5 w-3.5 text-[var(--app-hint)] shrink-0" collapsed={isCollapsed} />
        <span className="font-medium text-sm truncate flex-1">{group.displayName}</span>
        <span className="text-[11px] tabular-nums text-[var(--app-hint)] shrink-0">({group.sessions.length})</span>
    </button>
    <CopyPathButton path={group.directory} className="opacity-0 group-hover/project:opacity-100 transition-opacity duration-150" />
</div>

Summary

  • Review mode: initial
  • 1 finding: the new project-group header contains a nested <button>, which is invalid HTML and a keyboard/screen-reader regression.
  • Residual risk: Not found in repo/docs: component coverage for the new archived-section toggle and auto-expand-on-selection behavior.

Testing

  • Not run (automation)

HAPI Bot

Comment thread web/src/components/SessionList.tsx Outdated
const { group, isCollapsed, onToggle, onSelect, api, selectedSessionId } = props
return (
<div>
<button
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

[MAJOR] ProjectGroupItem now uses a <button> for the whole row, but CopyPathButton inside this row still renders its own <button> (web/src/components/SessionList.tsx:497). Nested buttons are invalid HTML and often break keyboard focus / assistive-tech behavior. Keep the toggle button and copy button as siblings instead of parent and child.

Suggested fix:

<div className="group/project ...">
    <button
        type="button"
        className="flex min-w-0 flex-1 items-center gap-2 text-left"
        onClick={onToggle}
        title={group.directory}
        aria-expanded={!isCollapsed}
    >
        ...
    </button>
    <CopyPathButton path={group.directory} className="opacity-0 group-hover/project:opacity-100 transition-opacity duration-150" />
</div>

Move CopyPathButton out of the toggle <button> to be a sibling,
preventing invalid nested <button> HTML that breaks keyboard focus
and assistive tech.
Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Findings

  • No additional diff-attributable issues identified in the current head.

Summary

  • Review mode: follow-up after new commits
  • No new findings on the latest diff.
  • Residual risk: Not found in repo/docs or adjacent SessionList tests: coverage for the archived-section toggle, auto-expanding the archived section when the selected session is archived, and cleanup of stale archived-collapse state.

Testing

  • Not run (automation): bun is not available in this runner, so bun run test web/src/components/SessionList.test.ts and bun run typecheck could not be executed.

HAPI Bot

Copy link
Copy Markdown

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Findings

  • No additional diff-attributable issues identified in the current head.

Summary

  • Review mode: follow-up after new commits
  • No new findings on the latest diff.
  • Residual risk: Not found in adjacent SessionList tests: coverage for the archived-section toggle, auto-expanding the archived section when the selected session is archived, and cleanup of stale archived-collapse state.

Testing

  • Not run (automation): bun is not available in this runner, so bun test web/src/components/SessionList.test.ts and bun run typecheck could not be executed.

HAPI Bot

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