Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(webui): File Browser row-click selects the file, not just preview#1734

Merged
itomek merged 2 commits into
mainfrom
tmi/1562-filebrowser-row-select
Jun 18, 2026
Merged

fix(webui): File Browser row-click selects the file, not just preview#1734
itomek merged 2 commits into
mainfrom
tmi/1562-filebrowser-row-select

Conversation

@itomek

@itomek itomek commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Closes #1562

Why this matters

Before: in the Agent UI File Browser, clicking a file row only opened a preview — it never selected the file. Selection was possible only through the tiny per-row checkbox, so a user who clicked a file the natural way saw a preview, assumed the file was selected, and found Index Selected and Ask Agent greyed out with no hint why. The core index→ask workflow was effectively undiscoverable unless you guessed the checkbox or used drag-and-drop.

After: clicking a file row selects it — the obvious gesture — so the action buttons enable immediately. Preview moves to an explicit per-row eye icon: still one click, just no longer conflated with selection.

Real-world verification

Production build served by gaia.ui.server and driven in a real browser on an AMD Ryzen AI box.

Before — nothing selected, both buttons disabled:

before

After clicking the file row — file selected (checkbox ticked, "1 item(s) selected"), Index Selected + Ask Agent enabled:

after

The new eye icon previews without selecting — the previewed file stays unchecked and the selection count is unchanged:

preview

Test plan

  • cd src/gaia/apps/webui && npm run test -- FileBrowser — new RTL test, 3 cases: row-click selects → buttons enable; eye icon previews without selecting; checkbox still toggles
  • npm test — full suite green (65 tests, +3 new)
  • npx tsc --noEmit — clean
  • Real-world (AMD Ryzen AI): clicked a file row in the live Agent UI → Index Selected and Ask Agent enabled (screenshots above)

Tomasz Iniewicz added 2 commits June 18, 2026 10:31
Row click on a file now toggles selection so Index Selected and Ask
Agent become active without needing to find the checkbox. Preview is
still available via the per-row Eye icon that appears on hover/focus.
The shared toggleSelection helper DRYs up the checkbox handler.
@github-actions github-actions Bot added the electron Electron app changes label Jun 18, 2026
@itomek itomek marked this pull request as ready for review June 18, 2026 14:51
@itomek itomek requested a review from kovtcharov-amd as a code owner June 18, 2026 14:51
@github-actions

Copy link
Copy Markdown
Contributor

Review: fix(webui): File Browser row-click selects the file

Summary

Solid, well-scoped fix for a real discoverability bug (#1562): clicking a file row now selects it instead of opening a preview, so Index Selected / Ask Agent enable on the obvious gesture, and preview moves to an explicit eye icon. The change is small, the duplicated checkbox-toggle logic is correctly extracted into one toggleSelection helper, and it ships with a focused test that includes a regression guard for the original checkbox path. Nothing blocking — a couple of optional UX/a11y notes below.

Issues

🟢 Row is click-only, not keyboard-operable (FileBrowser.tsx:563-568)
The entry <div> carries onClick/onDoubleClick but no role, tabIndex, or key handler, so the now-primary "select a file" gesture can't be reached by keyboard. This is pre-existing (the row was already click-to-preview before this PR), so it's not a regression and not blocking — but since this PR makes row-click the main selection affordance, it's a natural moment to close the gap. The checkbox remains keyboard-reachable, so the function isn't lost. Worth a follow-up rather than holding this PR.

🟢 Unsupported files are now selectable by row-click (FileBrowser.tsx:566)
A file badged "Not indexable" can now be toggled into the selection by clicking its row (previously a click just previewed). This is handled gracefully downstream — handleIndexSelected shows an actionable error when everything selected is unsupported (FileBrowser.tsx:301-314) and skips unsupported types otherwise — so it's a minor UX wrinkle, not a bug. No change required.

Strengths

  • Genuine DRY win: the inline checkbox onChange toggle was lifted into a single toggleSelection callback now shared by the row and the checkbox — both stay in sync by construction (FileBrowser.tsx:282-289).
  • The new eye-icon button is done right: type="button", stopPropagation so it never selects, an aria-label, and a :focus-visible outline in the CSS — keyboard- and screen-reader-friendly.
  • Good test, not just coverage: the third case explicitly guards that the checkbox still toggles on and off, locking in the path the refactor touched; the second asserts preview fires without selecting. Tests drive behavior through roles (getByRole), which is robust.

Verdict

Approve. No blocking issues; the two notes are optional follow-ups. Test plan (RTL suite, tsc --noEmit, real-browser verification with screenshots) is thorough for a UI change of this size.

Note: I couldn't execute the test suite in the review environment (node_modules not installed, install needs network), so I verified test correctness by reading — the assertions line up with the handlers (previewFile call, checkbox state). The PR reports the suite green (65 tests, +3).

@itomek itomek self-assigned this Jun 18, 2026

@kovtcharov-amd kovtcharov-amd left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Clean, focused fix. Row click now toggles selection; preview correctly moved to an explicit eye icon with stopPropagation on both the checkbox and preview button so there's no double-toggle. Good RTL coverage (row-select, preview-without-select, checkbox regression guard). All checks green. LGTM.

@itomek itomek added this pull request to the merge queue Jun 18, 2026
Merged via the queue into main with commit 1304b22 Jun 18, 2026
49 checks passed
@itomek itomek deleted the tmi/1562-filebrowser-row-select branch June 18, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

electron Electron app changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Agent UI File Browser: clicking a file row previews but doesn't select it, leaving Index/Ask buttons disabled

2 participants