fix: make sidebar folder clicks predictable and flicker-free - #273
Open
n00ki wants to merge 3 commits into
Open
Conversation
|
@n00ki is attempting to deploy a commit to the bholmesdev's projects Team on Vercel. A member of the Team first needs to authorize it. |
Contributor
There was a problem hiding this comment.
Overview
Separates sidebar folder selection from collapse: first row click expands/selects, second collapses only when that folder is already the sole selection; chevron toggles immediately; double-click second pulse ignored; selection bg no longer transitions (kills expansion flicker). DOM tests cover the main paths.
Audit
Comments
Sidebar.tsx:605— non-obvious select-before-collapse / chevron rule; matches local "why" style.Sidebar.tsx:1019— whybackground-colorleft the transition list; same bar as nearby drag/selection notes.
Tests
- Mirrors existing
Toolbar/useSidebarTreehappy-dom +createRootsetup. - Seeds expanded folders with the real storage key shape.
- Covers select-then-collapse, first-click expand, double-click, chevron collapse, multi-select reduce — distinct paths, not input-only variants.
Concerns
None material. Pre-click wasOnlySelectedRow is read before updateSelection, so sole-selection collapse and multi-select reduce both behave as described.
Verdict
Found: 0 critical, 0 important, 0 suggestions
Approve
Reviewed by a Warp Factory agent.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rationale
Sidebar folder clicks previously combined selection and expansion into one action. Clicking an unselected expanded folder could collapse it unexpectedly, while expanding a collapsed folder briefly showed the previous row’s highlight in its new position.
This change separates selection intent from collapse intent while preserving convenient one-click expansion:
The highlight flicker came from the row’s background-color transition. When expansion inserted new rows, the previous selection remained accented for one paint after moving. Sidebar selection backgrounds now update immediately, while opacity and filter transitions used for drag feedback remain animated.
Alternatives considered
I considered requiring two clicks before expanding any unselected folder. This avoided accidental toggles but added friction to the most common folder interaction.
I also considered preserving background transitions by sequencing selection and expansion separately. The previous highlight could still remain visible while rows moved, and delaying expansion made the interaction feel less responsive.
A separate chevron button would provide clearer event boundaries, but the row is already a button and nesting another button would be invalid. Restructuring the row would also affect keyboard navigation and drag behavior. The existing chevron region is therefore used as the explicit toggle target, with a larger hit area.
Summary
Testing
pnpm --filter @hubble.md/ui test -- Sidebar.test.tsxpnpm checkpnpm check:react-compilerpnpm build:desktop