Skip to content

fix(#475): Add aria-live regions for balance display updates#582

Open
Rayhab2000 wants to merge 1 commit into
Pi-Defi-world:devfrom
Rayhab2000:feature/aria-live-balance-accessibility
Open

fix(#475): Add aria-live regions for balance display updates#582
Rayhab2000 wants to merge 1 commit into
Pi-Defi-world:devfrom
Rayhab2000:feature/aria-live-balance-accessibility

Conversation

@Rayhab2000

@Rayhab2000 Rayhab2000 commented Jun 24, 2026

Copy link
Copy Markdown
Contributor
  • Dashboard (app/[locale]/page.tsx): Add aria-live regions to ACBU balance, USD conversion, and Fiat balance displays to announce updates to screen readers via polling (30s) or after transactions
  • Send page (app/send/page.tsx): Add aria-live region to available balance display for real-time updates

Screen readers now announce balance changes politely without interrupting user's current output. Improves accessibility for
visually impaired users who can now perceive balance changes without navigating away.

closes #475

Summary by CodeRabbit

  • Accessibility

    • Improved live updates for balance and USD value displays so screen readers announce changes more clearly.
    • Added accessibility labels and region hints to the send dialog’s available balance text.
  • UI Improvements

    • Refined the ACBU balance and simulated USD balance presentation, including clearer loading states and compact placeholder text.
    • Updated balance and funding labels for a more consistent in-app display.

…ates

- Dashboard (app/[locale]/page.tsx): Add aria-live regions to ACBU balance, USD conversion, and Fiat balance displays to announce updates to screen readers via polling (30s) or after transactions
- Send page (app/send/page.tsx): Add aria-live region to available balance display for real-time updates

Screen readers now announce balance changes politely without interrupting user's current output.
Improves accessibility for visually impaired users who can now perceive balance changes without navigating away.
@drips-wave

drips-wave Bot commented Jun 24, 2026

Copy link
Copy Markdown

@Rayhab2000 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@coderabbitai

coderabbitai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Two pages receive ARIA live/atomic region attributes on balance display elements. The home page ACBU balance and simulated fiat USD sections are refactored with hardcoded labels, BalanceSkeleton for loading states, ≈ USD value formatting, and partial-rate/empty-state messaging. The send page available-balance element gains matching ARIA semantics.

Changes

ARIA Live Regions and Balance Display Refactor

Layer / File(s) Summary
Home page balance ARIA regions, BalanceSkeleton, and label changes
app/[locale]/page.tsx
Normalizes imports for BalanceSkeleton, Button, and RetryErrorBlock; wraps ACBU balance in an aria-live/aria-atomic div with ••••••/.../BalanceSkeleton states and ≈ USD formatting; wraps fiat USD block in an ARIA live region with fiatUsdInfo?.usd display, partial-rate notice, and hardcoded "Add demo funds" label.
Send page available-balance ARIA live region
app/send/page.tsx
Adds aria-live="polite", aria-atomic="true", role="region", and aria-label to the available-balance <p> element.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

Possibly related PRs

  • Pi-Defi-world/acbu-frontend#169: That PR refactored the send/page.tsx balance display with real balance data, on top of which this PR adds the ARIA live/atomic region semantics.

Poem

🐇 Hop hop, the balances glow,
With aria-live so screen readers know!
"≈ USD" whispers the page,
BalanceSkeleton spins on the stage,
No wallet left silent, no change unsaid —
Every update announced overhead! 🌟

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The PR also changes copy and hardcoded labels in the balance and fiat sections, which go beyond the aria-live requirement. Limit the diff to accessibility markup and keep copy or translation changes separate unless they are required for the live region behavior.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title is concise and accurately reflects the main change: adding aria-live regions for balance updates.
Linked Issues check ✅ Passed The PR adds live regions to the dashboard and send balance displays so screen readers announce dynamic balance changes.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

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

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

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.

🔧 Biome (2.5.0)
app/[locale]/page.tsx

File contains syntax errors that prevent linting: Line 134: Expected a statement but instead found '<<<<<<< HEAD:app/[locale]/page.tsx'.; Line 144: Expected a statement but instead found '=======
useScrollRestoration('/', !loading)'.; Line 146: Expected a statement but instead found '>>>>>>> origin/dev:app/page.tsx

useEffect(() =>'.; Line 165: Expected a statement but instead found ', [opts.token])'.; Line 315: Expected a JSX Expression, a Element, or a text but instead found '<<<<<<'.; Line 315: expected > but instead found [; Line 321: Unexpected token. Did you mean {'>'} or &gt;?; Line 321: Unexpected token. Did you mean {'>'} or &gt;?; Line 321: Unexpected token. Did you mean {'>'} or &gt;?; Line 321: Unexpected token. Did you mean {'>'} or &gt;?; Line 321: Unexpected token. Did you mean {'>'} or &gt;?; Line 321: Unexpected token. Did you mean {'>'} or &gt;?; Line 321: Unexpected token. Did you mean {'>'} or &gt;?

app/send/page.tsx

File contains syntax errors that prevent linting: Line 384: Expected corresponding JSX closing tag for 'div'.; Line 367: Expected corresponding JSX closing tag for 'Tabs'.; Line 484: expected ) but instead found {; Line 679: Expected a semicolon or an implicit semicolon after a statement, but found none; Line 679: Expected a semicolon or an implicit semicolon after a statement, but found none; Line 696: Expected an expression but instead found '<'.

🔧 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.

app/[locale]/page.tsx

Parsing error: Merge conflict marker encountered.

app/send/page.tsx

Parsing error: JSX element 'div' has no corresponding closing tag.


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.

@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: 2

Caution

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

⚠️ Outside diff range comments (1)
app/[locale]/page.tsx (1)

134-147: 🎯 Functional Correctness | 🔴 Critical | ⚡ Quick win

Resolve committed merge-conflict markers before merge.

<<<<<<<, =======, >>>>>>> markers are still in the file, which will fail TypeScript parsing/build.

Proposed fix
-<<<<<<< HEAD:app/[locale]/page.tsx
   const t = useTranslations('home');
   const format = useFormatter();
@@
-=======
   useScrollRestoration('/', !loading);
->>>>>>> origin/dev:app/page.tsx
@@
-<<<<<<< HEAD:app/[locale]/page.tsx
   <h3 className="text-sm font-semibold text-foreground">{t('recent_activity')}</h3>
   <Link href="/activity" className="text-xs text-primary font-medium">{t('view_all')}</Link>
-=======
-  <h3 className="text-sm font-semibold text-foreground md:text-base">Recent Activity</h3>
-  <Link href="/activity" className="text-xs text-primary font-medium md:text-sm">View all</Link>
->>>>>>> upstream/dev:app/page.tsx

Also applies to: 315-321

🤖 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/`[locale]/page.tsx around lines 134 - 147, Resolve the merge conflict in
the page component by removing the conflict markers and keeping the intended
logic from both sides. Restore the home page setup around useTranslations,
useFormatter, and the features array in app/[locale]/page.tsx, and also preserve
the useScrollRestoration('/', !loading) call from the other branch in the same
component. Make sure the final file contains no <<<<<<<, =======, or >>>>>>>
markers and that the resulting page component compiles cleanly.
🤖 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/`[locale]/page.tsx:
- Around line 233-235: The loading branch in the page render currently wraps
BalanceSkeleton inside a paragraph, which can create invalid nesting and
hydration issues if the skeleton renders block content. Update the balance/rates
loading branch in page.tsx to use a div wrapper instead of p, keeping the
existing text styling on the wrapper around BalanceSkeleton.
- Around line 214-217: Restore localization on the locale-scoped page by
replacing the newly hardcoded English labels/messages with translated strings
from the existing i18n source. Update the wallet balance label, the missing-rate
notice, and the “Add demo funds” text in the page component so they use the same
translation mechanism as the rest of app/[locale]/page.tsx. Use the existing UI
symbols in this file to locate the affected text and ensure all visible strings
are sourced from locale-aware keys rather than inline English.

---

Outside diff comments:
In `@app/`[locale]/page.tsx:
- Around line 134-147: Resolve the merge conflict in the page component by
removing the conflict markers and keeping the intended logic from both sides.
Restore the home page setup around useTranslations, useFormatter, and the
features array in app/[locale]/page.tsx, and also preserve the
useScrollRestoration('/', !loading) call from the other branch in the same
component. Make sure the final file contains no <<<<<<<, =======, or >>>>>>>
markers and that the resulting page component compiles cleanly.
🪄 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: de9baa0e-0c8e-4a6d-afd7-47d497871301

📥 Commits

Reviewing files that changed from the base of the PR and between 26aa16d and 73ce6b0.

📒 Files selected for processing (2)
  • app/[locale]/page.tsx
  • app/send/page.tsx

Comment thread app/[locale]/page.tsx
Comment on lines 214 to 217
<p className="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mb-1 md:text-xs">
ACBU
</p>
<p className="text-[10px] text-muted-foreground mb-1 md:text-xs">Wallet balance</p>

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Revert hardcoded English strings in the locale page.

This route is locale-scoped (app/[locale]/...), but several new labels/messages are now hardcoded (e.g., wallet label, missing-rate notice, “Add demo funds”), causing localization regressions.

Also applies to: 251-252, 270-277

🤖 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/`[locale]/page.tsx around lines 214 - 217, Restore localization on the
locale-scoped page by replacing the newly hardcoded English labels/messages with
translated strings from the existing i18n source. Update the wallet balance
label, the missing-rate notice, and the “Add demo funds” text in the page
component so they use the same translation mechanism as the rest of
app/[locale]/page.tsx. Use the existing UI symbols in this file to locate the
affected text and ensure all visible strings are sourced from locale-aware keys
rather than inline English.

Comment thread app/[locale]/page.tsx
Comment on lines 233 to 235
) : balanceLoading || ratesLoading ? (
<<<<<<< HEAD:app/[locale]/page.tsx
<p className="text-sm text-muted-foreground mt-1.5">{t('approx_usd')} ...</p>
) : balance == null ? (
<p className="text-sm text-muted-foreground mt-1.5">{t('approx_usd')} —</p>
) : acbuUsd != null ? (
<p className="text-sm text-muted-foreground mt-1.5 tabular-nums">
{t('approx_usd')} {format.number(acbuUsd, { minimumFractionDigits: 0, maximumFractionDigits: 2 })}
</p>
) : (
<p className="text-sm text-muted-foreground mt-1.5">{t('approx_usd')} —</p>
)}
</div>
<div className="flex-1 min-w-0 text-right">
<p className="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground mb-1">
{t('fiat')}
</p>
<p className="text-[10px] text-muted-foreground mb-1">{t('simulated_usd_equivalent')}</p>
<div className="text-2xl sm:text-3xl font-bold text-foreground tabular-nums space-y-1">
=======
<p className="text-sm text-muted-foreground mt-1.5 md:text-base"><BalanceSkeleton variant="compact" /></p>
) : acbuUsd != null ? (

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.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Avoid rendering BalanceSkeleton inside a <p>.

The loading branch wraps a component in <p>...</p>; if that component renders block content, this creates invalid nesting and can cause hydration/DOM correction issues. Use a <div> wrapper for the skeleton branch.

🤖 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/`[locale]/page.tsx around lines 233 - 235, The loading branch in the page
render currently wraps BalanceSkeleton inside a paragraph, which can create
invalid nesting and hydration issues if the skeleton renders block content.
Update the balance/rates loading branch in page.tsx to use a div wrapper instead
of p, keeping the existing text styling on the wrapper around BalanceSkeleton.

@Junman140

Copy link
Copy Markdown
Member

@Rayhab2000 fix conflict

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.

No aria-live region for dynamically updating balance display

2 participants