Repository navigation
fix(apps-menu): preselect the first folder item only on keyboard open - #1856
Conversation
FolderModal always initialized its selection to the first item, so opening a folder with the mouse left that item painted with the selected style (accent outline and background) as if it were stuck, until arrow keys moved the selection. The pinned view already starts with no selection. FolderItem now tells the modal whether it was opened from the keyboard (Enter/Space on the item, or the view's Enter handler, which calls element.click() and so produces a click with detail === 0). Only then is the first item preselected; a mouse open starts with no selection and the arrow keys still select the first item on the first press. Fixes eythaann#1774 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
| class:is-dropping={sortable.isDropping} | ||
| class:is-drop-target={isActiveDropzone} | ||
| onclick={openModal} | ||
| onclick={(e) => openModal(e.detail === 0)} |
There was a problem hiding this comment.
Missing selection tests The click handler now decides whether the modal selects its first item, but there is no automated test for mouse opening, keyboard opening, or the first arrow-key press after a mouse opening. The repository guidance calls for tests when behavior changes. Please add coverage for these paths before merging.
Context Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
There was a problem hiding this comment.
The repo has no test runner for the Svelte widgets (npm test is empty; the only TS tests are the libs/core ones under Deno), and this logic lives in component event handlers, so a unit test would need a component test setup that does not exist yet. The mouse path and the keyboard path were checked by hand in a dev build (see the PR description). The first arrow key after a mouse open was not tested live; it relies on navigateInDirection selecting the first item when nothing is selected, the same path the pinned view already uses. Happy to add tests if the maintainer wants that setup.
There was a problem hiding this comment.
That context is fair. Since this repository has no Svelte component test runner, adding automated coverage would require introducing a new test setup rather than just adding regression cases. The documented dev-build checks cover the mouse-open, keyboard-open, and first-arrow-key paths, so I’m withdrawing the request for tests for this PR.
There was a problem hiding this comment.
That’s fair context. Since there is no Svelte component-test harness and the changed behavior is confined to component event wiring, the dev-build checks are a reasonable validation for this PR; I’ll treat the missing tests as a non-blocking suggestion rather than a merge requirement. The first-arrow behavior is also handled by the existing navigateInDirection null-selection branch, so adding a test specifically for it can wait until component-test infrastructure exists.
There was a problem hiding this comment.
Understood. I’ll no longer ask for automated UI/component tests when this repository lacks a component test runner or harness; documented manual validation and existing code-path coverage will be sufficient in that situation.
Tip: You can customize Greptile's behavior for this repo with .greptile/rules.md and .greptile/config.json.
Fixes #1774
Problem
FolderModalalways initialized its selection to the first item. Opening a folder with the mouse therefore painted that item with the selected style (accent outline and background) as if it were stuck, until the arrow keys moved the selection. The pinned view already starts with no selection.Fix
FolderItemtells the modal whether it was opened from the keyboard: Enter/Space on the item, or the pinned view's Enter handler, which callselement.click()and so produces a click withdetail === 0. Only then is the first item preselected. A mouse open starts with no selection, and the first arrow key press still selects the first item (navigateInDirectionalready handles a null selection).Testing
Tested in a dev build on Windows 11 26200 with a pinned folder of four apps:
navigateInDirection, which selects the first item when nothing is selected).svelte-check: 0 errors. CI green on the fork.🤖 Generated with Claude Code