Skip to content

Restore collapsed-by-default location dropdown#661

Merged
wikirby merged 1 commit into
masterfrom
user/wikirby/section-picker-collapse
Jun 5, 2026
Merged

Restore collapsed-by-default location dropdown#661
wikirby merged 1 commit into
masterfrom
user/wikirby/section-picker-collapse

Conversation

@wikirby
Copy link
Copy Markdown
Contributor

@wikirby wikirby commented Jun 5, 2026

Problem

The location (notebook/section) dropdown rendered every notebook and section group fully expanded. Customers with many notebooks/section groups had to scroll through the entire flattened tree to find their target section.

In the original picker, the dropdown defaulted to collapsed and expanded only the notebook and section groups leading to the currently selected section. The V2/V3 unified-window rewrite of the picker lost that behavior.

Fix

Restore the collapse-by-default behavior in renderer.ts:

  • flattenSections / flattenSectionGroups now report whether their subtree contains the selected section, so each notebook/section-group heading collapses unless it sits on the path to that section.
  • New refreshSectionVisibility() recomputes row visibility from collapsed state in a single pass that tracks the shallowest collapsed depth, so nested collapse/expand is honored correctly. Section rows now carry data-depth.
  • When there is no stored selection (or it no longer exists), default to the first available section and reveal its path, so the dropdown always opens to a visible, expanded selection rather than an all-collapsed list.

Notes

  • On open, the selected section is focused and scrolled into view as before; only its ancestry is expanded. Other notebooks/groups can be expanded by clicking their chevron.
  • Single-file change. Build and lint pass; verified the change ships in the Edge target.

🤖 Generated with Claude Code

The location/section dropdown now defaults to collapsed, expanding only
the notebook and section groups along the path to the currently selected
section. This restores the original picker behavior and makes long
notebook lists navigable again.

- flattenSections/flattenSectionGroups report whether their subtree holds
  the selected section so each heading collapses unless it is on the path
- refreshSectionVisibility recomputes row visibility in a single pass that
  honors nested collapse state
- default to the first available section (and reveal its path) when there
  is no stored selection or it no longer exists

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wikirby wikirby force-pushed the user/wikirby/section-picker-collapse branch from 9058d22 to 76658d7 Compare June 5, 2026 15:44
@aanchalbhansali aanchalbhansali self-requested a review June 5, 2026 18:58
Copy link
Copy Markdown
Contributor

@aanchalbhansali aanchalbhansali left a comment

Choose a reason for hiding this comment

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

Approved

@wikirby wikirby merged commit 8833f0e into master Jun 5, 2026
3 checks passed
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.

2 participants