Skip to content

fix(dashboard): make Hook Logs table rows keyboard accessible (#525) - #619

Open
AVPthegreat wants to merge 2 commits into
FailproofAI:mainfrom
AVPthegreat:fix/dashboard-hook-logs-keyboard-accessibility
Open

fix(dashboard): make Hook Logs table rows keyboard accessible (#525)#619
AVPthegreat wants to merge 2 commits into
FailproofAI:mainfrom
AVPthegreat:fix/dashboard-hook-logs-keyboard-accessibility

Conversation

@AVPthegreat

@AVPthegreat AVPthegreat commented Jul 28, 2026

Copy link
Copy Markdown

Summary

Fixes #525 by adding keyboard accessibility support (tabIndex={0}, role="button", aria-expanded={isExpanded}, onKeyDown handlers) and focus ring indicators to Hook Logs table rows in the Next.js dashboard components (app/policies/hooks-client.tsx and app/components/session-hooks-panel.tsx).


❌ Root Cause Analysis

In app/policies/hooks-client.tsx and app/components/session-hooks-panel.tsx, table rows in the Hook Logs table rendered <tr onClick={() => toggleRow(i)}> without accessibility attributes:

<tr
  onClick={() => toggleRow(i)}
  className={`activity-data-row cursor-pointer transition-colors ${...}`}
>

Why it failed:

  1. The <tr> elements lacked tabIndex={0}, making them unreachable via keyboard Tab / Shift+Tab navigation.
  2. The rows lacked role="button" and aria-expanded, preventing screen readers and keyboard users from understanding that the row was expandable.
  3. There was no onKeyDown handler, so pressing Enter or Space when focused on a row did not trigger row expansion.

✅ Fix Details

Updated <tr in both app/policies/hooks-client.tsx and app/components/session-hooks-panel.tsx:

<tr
  tabIndex={0}
  role="button"
  aria-expanded={isExpanded}
  onClick={() => toggleRow(i)}
  onKeyDown={(e) => {
    if (e.key === "Enter" || e.key === " ") {
      e.preventDefault();
      toggleRow(i);
    }
  }}
  className={`activity-data-row cursor-pointer transition-colors focus:outline-none focus:ring-1 focus:ring-ring ${...}`}
>

🧪 Verification

  • Verified keyboard accessibility (Tab focus, Enter/Space row toggle).
  • Verified aria-expanded state tracking and visual focus ring indicator.
  • Ran test suite: 1199 tests passed.

Summary by CodeRabbit

  • Accessibility Improvements
    • Expandable activity and hook log rows can now be navigated and toggled using the keyboard.
    • Added focus indicators and expanded/collapsed state announcements for assistive technologies.

Copilot AI review requested due to automatic review settings July 28, 2026 15:20
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4b4c97c7-4217-4732-a0ac-29ba9f6afcca

📥 Commits

Reviewing files that changed from the base of the PR and between fc0aedb and 79b9e77.

📒 Files selected for processing (2)
  • app/components/session-hooks-panel.tsx
  • app/policies/hooks-client.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/components/session-hooks-panel.tsx
  • app/policies/hooks-client.tsx

📝 Walkthrough

Walkthrough

Expandable rows in the Hook Logs and Activity tables now support keyboard activation, expose expanded state through ARIA, become focusable, and display focus-ring styling.

Changes

Table row accessibility

Layer / File(s) Summary
Keyboard and ARIA row toggles
app/components/session-hooks-panel.tsx, app/policies/hooks-client.tsx
Expandable rows are focusable, expose aria-expanded, toggle on Enter or Space with default behavior prevented, and include focus-ring styling.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Poem

I tap my paws; the rows unfold,
With focus rings bright as gold.
Enter, Space—the details flow,
ARIA tells what’s open below.
Hop, hop—accessible logs aglow!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: keyboard accessibility for Hook Logs table rows in the dashboard.
Description check ✅ Passed The description explains the fix, rationale, implementation, and verification, matching the PR's purpose.
Linked Issues check ✅ Passed The changes implement keyboard focus, Enter/Space toggling, aria-expanded, and focus styles for the Hook Logs rows in both files, satisfying #525.
Out of Scope Changes check ✅ Passed Only accessibility updates related to the Hook Logs rows were introduced, with no unrelated code changes apparent.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

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

@hermes-exosphere

Copy link
Copy Markdown
Contributor

Your PR is awaiting review by a reviewer. Till then you can join the Discord for conversation: https://discord.befailproof.ai

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses issue #525 by improving keyboard operability and focus visibility for expandable “Hook Logs” table rows in the dashboard UI.

Changes:

  • Makes hook-log table rows focusable via keyboard and togglable via Enter/Space.
  • Adds expanded-state signaling (aria-expanded) and visual focus ring styling to the interactive rows.
  • Applies the same accessibility treatment in both the policies activity view and the session hooks panel.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
app/policies/hooks-client.tsx Adds keyboard/focus accessibility behaviors to expandable hook activity table rows.
app/components/session-hooks-panel.tsx Mirrors the same row keyboard/focus accessibility behaviors in the session hooks panel table.
Comments suppressed due to low confidence (2)

app/policies/hooks-client.tsx:687

  • Handling Space/Enter on onKeyDown without guarding e.repeat can cause rapid re-toggles when a key is held down (key auto-repeat). Add an e.repeat guard (or handle Space on keyup) to ensure a single toggle per press.
                          if (e.key === "Enter" || e.key === " ") {
                            e.preventDefault();
                            toggleRow(i);
                          }
                        }}

app/components/session-hooks-panel.tsx:339

  • Handling Space/Enter on onKeyDown without guarding e.repeat can cause rapid re-toggles when a key is held down (key auto-repeat). Add an e.repeat guard (or handle Space on keyup) to ensure a single toggle per press.
                        if (e.key === "Enter" || e.key === " ") {
                          e.preventDefault();
                          toggleRow(i);
                        }
                      }}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/policies/hooks-client.tsx Outdated
<React.Fragment key={`${item.timestamp}-${i}`}>
<tr
tabIndex={0}
role="button"
Comment thread app/components/session-hooks-panel.tsx Outdated
<React.Fragment key={`${item.timestamp}-${i}`}>
<tr
tabIndex={0}
role="button"
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Caution

Failed to replace (edit) comment. This is likely due to insufficient permissions or the comment being deleted.

Error details
putComment timed out

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@app/components/session-hooks-panel.tsx`:
- Around line 330-340: The expandable rows in
app/components/session-hooks-panel.tsx lines 330-340 and
app/policies/hooks-client.tsx lines 678-688 should retain native <tr> semantics
by removing row-level role, focus, and keyboard interaction. Add an inner
disclosure button within the appropriate cell in each row, moving aria-expanded,
toggleRow behavior, keyboard handling, and focus styling to that button while
preserving the existing expansion behavior.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 714c3afc-561d-4677-b859-dde211c95dba

📥 Commits

Reviewing files that changed from the base of the PR and between af74838 and fc0aedb.

📒 Files selected for processing (2)
  • app/components/session-hooks-panel.tsx
  • app/policies/hooks-client.tsx

Comment on lines +330 to +340
tabIndex={0}
role="button"
aria-expanded={isExpanded}
onClick={() => toggleRow(i)}
className={`cursor-pointer transition-colors ${
onKeyDown={(e) => {
if (e.key === "Enter" || e.key === " ") {
e.preventDefault();
toggleRow(i);
}
}}
className={`cursor-pointer transition-colors focus:outline-none focus:ring-1 focus:ring-ring ${

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate files =="
git ls-files | rg 'app/(components/session-hooks-panel|policies/hooks-client)\.tsx$' || true

echo "== file sizes =="
wc -l app/components/session-hooks-panel.tsx app/policies/hooks-client.tsx

echo "== snippets around affected lines =="
sed -n '300,355p' app/components/session-hooks-panel.tsx
printf '\n---\n'
sed -n '655,705p' app/policies/hooks-client.tsx

echo "== nearby context and role/button occurrences in affected TSX =="
rg -n 'role="button"|tabIndex=0|aria-expanded=|<tr|</tr|onKeyDown=.*e\.key|window\.preventDefault' app/components/session-hooks-panel.tsx app/policies/hooks-client.tsx

Repository: FailproofAI/failproofai

Length of output: 7279


🌐 Web query:

WAI-ARIA grid row role hidden semantics table row role aria-expanded button row

💡 Result:

Under WAI-ARIA standards, a row (role=row) should contain only specific child roles—typically gridcell, columnheader, or rowheader [1][2][3][4]. Placing a button directly as a child of a row is considered invalid according to strict semantic structure, as accessibility APIs expect grid cells to be the immediate children of rows [5]. Regarding your specific architectural questions: 1. Hidden Semantics: If rows or cells are hidden (e.g., via display: none or not present in the DOM), they are excluded from the accessibility tree [6]. To maintain correct row counting and indexing for assistive technologies when rows or columns are missing from the DOM, you must use aria-rowcount, aria-colcount, aria-rowindex, and aria-colindex on the appropriate elements [7][1][6][3]. 2. Button within a Row: Placing a button as a direct child of a row violates the requirement that rows contain only cells [5]. The correct, accessible pattern for an interactive element (like an expand/collapse toggle) inside a row is to place the button inside a gridcell [6][8][5]. 3. aria-expanded: The aria-expanded attribute should be placed on the interactive control (the button) that performs the toggle action, not on the row element itself [9][8]. When a grid requires hierarchical "expand/collapse" behavior (where a row controls the visibility of child rows), the pattern is a treegrid, not a standard grid [10][8]. In a treegrid, the aria-expanded state is managed on the parent row or a cell within that row, indicating whether the child rows are currently visible [9][10]. For most web applications, if you need expandable rows, using the treegrid role with the proper hierarchical ARIA attributes (aria-level, aria-expanded) is the recommended approach [10][8]. Always prefer native HTML table elements (table, tr, td) if the data is tabular, as they provide these semantics automatically [1][3][4]. If you must use ARIA roles for custom layouts, ensure your DOM structure strictly adheres to the required parent-child relationships (grid > row > gridcell) [1][2][3]. Top results: [1], [3], [9], [8], [5]

Citations:


Keep expandable table rows as rows and use an inner disclosure button.

Both interactive rows assign role="button" to native <tr> elements, which replaces the table row semantics from the descendant cells. Keep the <tr> native and move the focus/action semantics to a proper control inside a cell, such as an inner <button> with aria-expanded, keyboard handling, and focus styling.

  • app/components/session-hooks-panel.tsx#L329-L331
  • app/policies/hooks-client.tsx#L677-L679
📍 Affects 2 files
  • app/components/session-hooks-panel.tsx#L330-L340 (this comment)
  • app/policies/hooks-client.tsx#L678-L688
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@app/components/session-hooks-panel.tsx` around lines 330 - 340, The
expandable rows in app/components/session-hooks-panel.tsx lines 330-340 and
app/policies/hooks-client.tsx lines 678-688 should retain native <tr> semantics
by removing row-level role, focus, and keyboard interaction. Add an inner
disclosure button within the appropriate cell in each row, moving aria-expanded,
toggleRow behavior, keyboard handling, and focus styling to that button while
preserving the existing expansion behavior.

Source: MCP tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Dashboard Hook Logs table rows are not keyboard-accessible

3 participants