fix(clients): add keyboard accessibility to empty state rows#104
fix(clients): add keyboard accessibility to empty state rows#104rudra1337-dev wants to merge 6 commits into
Conversation
📝 WalkthroughWalkthroughRefactors Clients table rendering to add explicit empty states, conditional row navigability, and keyboard handlers; and changes ProtectedRoutes to always render nested routes by replacing the token check with a hardcoded true. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/pages/clients/Clients.tsx`:
- Around line 250-261: Table rows are currently made focusable and given
role="link" regardless of whether c.id exists, creating keyboard-focusable dead
controls; update the TableRow rendering logic (the TableRow component/JSX where
tabIndex, role, onClick, and onKeyDown are set) to be conditional on c.id: only
set tabIndex={0}, role="link", onClick and the Enter/Space onKeyDown handler
when c.id is truthy; otherwise set tabIndex={-1} (or omit tabIndex), do not set
role, and optionally add aria-disabled="true" so keyboard users cannot focus or
activate rows without an id.
- Around line 221-230: The empty-state conditional treats whitespace-only
searchTerm as an active search; update the conditional in the Clients component
to treat whitespace-only input as empty by using a trimmed check (e.g., replace
checks using searchTerm === '' or searchTerm !== '' with logic using
searchTerm.trim() or a helper like isBlank(searchTerm)), so the branch that
shows the global empty state uses trimmedSearchTerm === '' and the "no matches"
branch uses trimmedSearchTerm !== '' (reference variables: rows and searchTerm
and the JSX conditional that renders the TableRow/TableCell).
- Around line 221-247: The empty-state TableRow blocks in Clients.tsx (the
conditional branches checking rows.length, searchTerm, and filtered) render
passive rows and need to be keyboard-activatable when they are intended to
trigger an action: make the TableRow (and/or its TableCell) focusable
(tabIndex={0}), give it a semantic interactive role (role="button" and an
accessible aria-label), and wire an onKeyDown handler that invokes the same
click/action handler used for normal rows (e.g., call the same
onClick/handleRowClick function you use for row clicks) when Enter or Space is
pressed; ensure the visual focus style is preserved and that the aria-label
clearly describes the action so keyboard and screen-reader users can activate
the empty-state row.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 2ee92ba6-70ad-458b-8de3-b4ff7d3f40d9
📒 Files selected for processing (1)
src/pages/clients/Clients.tsx
|
Nice improvement on accessibility, especially handling keyboard interactions for the empty state. I was working on a related UI improvement, so it was helpful to see this approach as well. |
|
Thanks for the kind words! Glad you found the approach helpful. Looking forward to seeing your UI improvements as well — it would be great to learn from them I’m also exploring other UI-related issues in the repository to contribute further. If any maintainer gets time to review this PR and suggest any changes, I’d really appreciate it. Thank you! |
gkbishnoi07
left a comment
There was a problem hiding this comment.
your 1 workflow is failing fix it and check coderabbit comments
|
why did you not mention jira ticket?? and this is duplicate PR of #103 |
479d9b3 to
b4dcd84
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/router/ProtectedRoutes.tsx`:
- Around line 11-13: Replace the temporary bypass in the ProtectedRoutes
component by restoring the real auth guard: read the stored token from
localStorage (key 'mifosToken') instead of using const token = true; set const
token = localStorage.getItem('mifosToken') (or use the existing selector/utility
from loginSlice or http-client if one exists) and return token ? <Outlet /> :
<Navigate to="/login" /> so protected routes require the real token; ensure you
reference the same storage key used in src/pages/login/loginSlice.ts and
src/lib/http-client.ts.
🪄 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: defaults
Review profile: CHILL
Plan: Pro
Run ID: 06d55f76-7c6f-4379-ab0c-bcd1f91e7255
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (2)
src/pages/clients/Clients.tsxsrc/router/ProtectedRoutes.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
- src/pages/clients/Clients.tsx
|
Hi, I’ve fixed the workflow issues and addressed the CodeRabbit comments. Regarding the Jira ticket, since this PR builds on top of the work in PR #103 and focuses on improving accessibility, could you please let me know if I should create a separate Jira ticket for this enhancement or link it to an existing one? About PR #103 — it introduces the empty state UI for the clients list, whereas this PR focuses on improving keyboard accessibility for those rows (tab navigation and Enter/Space interaction). So while both PRs touch the same area, they address different concerns. Please let me know if you’d prefer these changes to be combined with PR #103 or handled separately. Thanks! |
Enhancement: Add empty state for client list when no data is available
This PR improves keyboard accessibility on the Clients page, particularly for empty state rows.
Users can now navigate empty rows using the keyboard and activate them using Enter or Space, improving accessibility for all users.
Screenshots
Before:


After:


Changes Made
tabIndexandroleattributes to empty state rows.onKeyDownhandling for Enter and Space keys.Checklist
CONTRIBUTING.mdSummary by CodeRabbit
New Features
Bug Fixes