Skip to content

fix(files): prevent selection reset during keyboard navigation#2044

Merged
JammingBen merged 2 commits intomainfrom
fix/keyboard-nav-selection-reset
Feb 27, 2026
Merged

fix(files): prevent selection reset during keyboard navigation#2044
JammingBen merged 2 commits intomainfrom
fix/keyboard-nav-selection-reset

Conversation

@dschmidt
Copy link
Contributor

Summary

  • Keyboard arrow navigation used resetSelection() + await nextTick() + addSelection(), causing selectedIds to briefly become empty between the reset and the new selection
  • This empty state caused sidebar panel components (like the maps location panel) to be destroyed and recreated, since their isVisible check failed when items was momentarily empty
  • Mouse clicks used toggleSelection() which swaps atomically and didn't have this issue
  • Replace the reset+add sequence with a single setSelection([nextId]) call, which atomically replaces the selection without an intermediate empty state

Test plan

  • Unit tests verify that selectedIds is never empty during keyboard navigation
  • Navigate files with arrow keys while the sidebar is open — panels should not flicker/recreate
  • Navigate files with arrow keys — selection should move correctly
  • Shift+arrow key multi-selection still works as expected

Replace resetSelection() + addSelection() with atomic setSelection()
to avoid a brief empty selection state when navigating files with
arrow keys. The empty state caused sidebar panels to be destroyed
and recreated because their isVisible check failed momentarily.
@dschmidt dschmidt force-pushed the fix/keyboard-nav-selection-reset branch from f5e73de to 0c70f2f Compare February 27, 2026 13:25
Copy link
Member

@JammingBen JammingBen left a comment

Choose a reason for hiding this comment

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

👍

@JammingBen JammingBen merged commit b17c4c0 into main Feb 27, 2026
28 checks passed
@JammingBen JammingBen deleted the fix/keyboard-nav-selection-reset branch February 27, 2026 13:53
@openclouders openclouders mentioned this pull request Feb 27, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants