Skip to content

fix(ui): prevent directory picker folder clicks selecting#986

Merged
balazs-szucs merged 1 commit into
grimmory-tools:developfrom
imnotjames:fix/985/select-folder-confusion
Apr 29, 2026
Merged

fix(ui): prevent directory picker folder clicks selecting#986
balazs-szucs merged 1 commit into
grimmory-tools:developfrom
imnotjames:fix/985/select-folder-confusion

Conversation

@imnotjames

@imnotjames imnotjames commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Description

clicking the directory picker rows causes the picker to select those rows while entering them. only clicks on the checkbox should select the folder, clicking the rest of the row should lead to the user entering the folder

this prevents the folder text from activating the checkbox and moves the row selector to the row element - now clicking the checkbox selects, and everything else enters

Screencast.From.2026-04-29.00-49-56.mp4

Linked Issue: Fixes #985

Changes

  • moves onRowClick call to the row itself
  • swaps the label to a div + removes for so clicking it doesn't activate the checkbox
  • prevents space / enter on checkbox from causing row activation
  • adds styling for the row to handle the new selector location

Summary by CodeRabbit

  • Bug Fixes

    • Directory rows now activate with Enter/Space without duplicate triggers; checkbox keypresses no longer accidentally select the row. Aria labels improved for folder items.
  • Style

    • Improved keyboard focus styling on folder items with a clear, theme-colored focus ring for better accessibility.

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: cf01876e-0889-418f-9d82-7df23636009c

📥 Commits

Reviewing files that changed from the base of the PR and between 42a230f and 610d644.

📒 Files selected for processing (2)
  • frontend/src/app/shared/components/directory-picker/directory-picker.component.html
  • frontend/src/app/shared/components/directory-picker/directory-picker.component.scss
✅ Files skipped from review due to trivial changes (1)
  • frontend/src/app/shared/components/directory-picker/directory-picker.component.scss
🚧 Files skipped from review as they are similar to previous changes (1)
  • frontend/src/app/shared/components/directory-picker/directory-picker.component.html
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: Test Suite / Frontend Tests
  • GitHub Check: Test Suite / Backend Tests
  • GitHub Check: Frontend Lint Threshold Check
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Analyze (java-kotlin)

📝 Walkthrough

Walkthrough

Refactors directory-picker row activation so the outer .directory-item handles click and keyboard Enter/Space to navigate, removes the label-based activation, stops Enter/Space key events on the checkbox from bubbling, and adds a :focus-visible style for .directory-item.

Changes

Cohort / File(s) Summary
Directory Picker Interaction Handling
frontend/src/app/shared/components/directory-picker/directory-picker.component.html
Moves row activation (click + Enter/Space) to the outer .directory-item, removes the label-based activator, and prevents checkbox keyboard events (Enter/Space) from propagating so toggling the checkbox doesn't trigger row navigation.
Directory Picker Focus Styling
frontend/src/app/shared/components/directory-picker/directory-picker.component.scss
Adds .directory-item:focus-visible rules that remove the default outline, apply border-color: var(--primary-color), and set outline-offset: 0 for keyboard focus styling.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐇 I hopped through rows and found the nudge—no more accidental picks,
Clicks go where intended, checkboxes keep their tricks.
Focus rings glow when keys do steer,
Quiet navigation, selections clear.
Hooray — a tidy picker, from this rabbit's cheer!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title follows the conventional commit format with type(scope): description pattern and accurately reflects the main change to prevent unintended folder selection.
Description check ✅ Passed The description includes all required sections from the template, explains the problem and solution clearly, and lists the changes made.
Linked Issues check ✅ Passed The PR fully addresses the linked issue #985 by preventing navigation clicks from triggering checkbox selection, with changes to move row click handling, remove the label element, and prevent Space/Enter on the checkbox.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing the directory picker selection issue, with no extraneous modifications outside the scope of the linked issue.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

Comment @coderabbitai help to get the list of available commands and usage tips.

@imnotjames imnotjames force-pushed the fix/985/select-folder-confusion branch from 7a74573 to 42a230f Compare April 29, 2026 04:51
@imnotjames imnotjames marked this pull request as ready for review April 29, 2026 04:55

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
frontend/src/app/shared/components/directory-picker/directory-picker.component.html (1)

138-167: ⚠️ Potential issue | 🟠 Major

Add semantic role and accessible naming for the interactive row and checkbox.

The div.directory-item at line 141 has tabindex="0" for keyboard interaction but is missing a semantic role and accessible name. The p-checkbox at line 150 lacks an [ariaLabel] binding. These omissions create an accessibility gap for screen-reader users navigating the folder list.

♿ Suggested fix
 <div
   class="directory-item"
   [class.selected]="isFolderSelected(folder)"
   tabindex="0"
+  role="button"
+  [attr.aria-label]="getFolderName(folder)"
   (click)="onRowClick(folder)"
   (keydown.enter)="onRowClick(folder)"
   (keydown.space)="onRowClick(folder)"
 >
   <div class="directory-checkbox">
     <p-checkbox
       [inputId]="'folder-' + folder"
+      [ariaLabel]="getFolderName(folder)"
       [binary]="true"
       [(ngModel)]="selectedFoldersMap[folder]"
       (ngModelChange)="onCheckboxChange(folder, $event)"
       (click)="$event.stopPropagation()"
       (keydown.enter)="$event.stopPropagation()"
       (keydown.space)="$event.stopPropagation()"
     />
   </div>

Additionally, the (keydown.space) handler on the focusable div should call $event.preventDefault() to suppress the browser's default page-scroll behavior during Space activation.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@frontend/src/app/shared/components/directory-picker/directory-picker.component.html`
around lines 138 - 167, The interactive folder row (div.directory-item) lacks a
semantic role and accessible name and its space key handler doesn't prevent
default scrolling; update the element used by isFolderSelected(folder) and
onRowClick(folder) to include role="button" and an aria-label that uses
getFolderName(folder) (e.g., "Open folder {getFolderName(folder)}" or include
the folder path) and change the (keydown.space) to call $event.preventDefault()
before invoking onRowClick(folder). Also add an accessible label to the
p-checkbox used with selectedFoldersMap[folder] and onCheckboxChange(folder,
$event) by binding its ariaLabel (e.g., [ariaLabel]="'Select ' +
getFolderName(folder)"), and ensure the checkbox click/keydown handlers still
stop propagation. Ensure references remain to isFolderSelected, onRowClick,
selectedFoldersMap, onCheckboxChange, and getFolderName when making these
changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@frontend/src/app/shared/components/directory-picker/directory-picker.component.html`:
- Line 144: The Space key handler on the focusable row currently calls
onRowClick(folder) but doesn't prevent the browser's default scrolling; update
the template binding for (keydown.space) to call $event.preventDefault() before
invoking onRowClick(folder) so the page doesn't scroll when activating a row;
locate the (keydown.space)="onRowClick(folder)" binding in
directory-picker.component.html and change it to call $event.preventDefault()
then onRowClick(folder).

---

Outside diff comments:
In
`@frontend/src/app/shared/components/directory-picker/directory-picker.component.html`:
- Around line 138-167: The interactive folder row (div.directory-item) lacks a
semantic role and accessible name and its space key handler doesn't prevent
default scrolling; update the element used by isFolderSelected(folder) and
onRowClick(folder) to include role="button" and an aria-label that uses
getFolderName(folder) (e.g., "Open folder {getFolderName(folder)}" or include
the folder path) and change the (keydown.space) to call $event.preventDefault()
before invoking onRowClick(folder). Also add an accessible label to the
p-checkbox used with selectedFoldersMap[folder] and onCheckboxChange(folder,
$event) by binding its ariaLabel (e.g., [ariaLabel]="'Select ' +
getFolderName(folder)"), and ensure the checkbox click/keydown handlers still
stop propagation. Ensure references remain to isFolderSelected, onRowClick,
selectedFoldersMap, onCheckboxChange, and getFolderName when making these
changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: aabdcfa4-086f-4e93-99dd-64b416321efd

📥 Commits

Reviewing files that changed from the base of the PR and between b0a5394 and 42a230f.

📒 Files selected for processing (2)
  • frontend/src/app/shared/components/directory-picker/directory-picker.component.html
  • frontend/src/app/shared/components/directory-picker/directory-picker.component.scss
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
frontend/src/**/*.{ts,tsx,html,scss}

📄 CodeRabbit inference engine (AGENTS.md)

Use 2-space indentation in TypeScript, HTML, and SCSS in frontend code

Files:

  • frontend/src/app/shared/components/directory-picker/directory-picker.component.scss
  • frontend/src/app/shared/components/directory-picker/directory-picker.component.html
frontend/src/**/*.{ts,tsx,html}

📄 CodeRabbit inference engine (AGENTS.md)

frontend/src/**/*.{ts,tsx,html}: Follow frontend/eslint.config.js: component selectors use app-, directive selectors use app, and any is disallowed in frontend code
Put user-facing strings in Transloco files under frontend/src/i18n/

Files:

  • frontend/src/app/shared/components/directory-picker/directory-picker.component.html
🔇 Additional comments (1)
frontend/src/app/shared/components/directory-picker/directory-picker.component.scss (1)

373-377: Focus-visible styling is a good match for the row-level interaction change.

This improves keyboard discoverability after making the whole row focusable/clickable.

only clicks on the checkbox should select the folder, clicking the rest
of the row should lead to the user entering the folder
@imnotjames imnotjames force-pushed the fix/985/select-folder-confusion branch from 42a230f to 610d644 Compare April 29, 2026 05:20
@balazs-szucs balazs-szucs merged commit 0fad5c1 into grimmory-tools:develop Apr 29, 2026
16 checks passed
dsmouse pushed a commit to dsmouse/grimmory that referenced this pull request May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Library directory picker: navigation triggers unwanted selections

2 participants