Skip to content

fix(wallet): prevent event bubbling and add responsive address truncation in WalletConnectButton (#887) - #1007

Merged
k-deejah merged 5 commits into
Sorokit:mainfrom
bamiebot-maker:fix/887-wallet-connect-button-bubbling
Oct 18, 2026
Merged

k-deejah merged 5 commits into
Sorokit:mainfrom
bamiebot-maker:fix/887-wallet-connect-button-bubbling

Conversation

@bamiebot-maker

Copy link
Copy Markdown
Contributor

Closes #887

Summary of Changes

  1. Event Bubbling Prevention:
    • Added e.stopPropagation() in WalletConnectButton's onClick handlers across disconnected trigger, connected trigger with onOpenModal, connected dropdown trigger, and clear-error action to prevent click events from bubbling to ancestor clickable containers (e.g. account list cards).
  2. Accessible Attributes:
    • Added aria-haspopup="dialog" and dynamic aria-expanded={connectModalOpen} on the disconnected trigger button.
    • Added aria-haspopup="dialog" and aria-expanded={false} on connected button when onOpenModal is provided.
  3. Responsive Address Truncation:
    • Implemented truncateAddressResponsive in src/lib/utils.ts supporting compact truncation (compact: true, default bounds 3/3) for narrow mobile viewports (<360px).
    • In WalletConnectButton, rendered compact address for small viewports (inline sm:hidden) and standard address for larger viewports (hidden sm:inline) with max-w-full to prevent text clipping and container overflow.
  4. Unit Tests & Quality:
    • Added unit tests in WalletConnectButton.test.tsx verifying event bubbling prevention, ARIA attributes, and responsive truncation rendering.
    • Added unit tests in utils.test.ts verifying truncateAddressResponsive behavior.
    • Fixed caught error handling in NetworkSwitcher.tsx to satisfy the ESLint preserve-caught-error rule.
    • Verified TypeScript compilation (npm run typecheck), linting (npm run lint), and export tests (npm run test:exports).

@drips-wave

drips-wave Bot commented Oct 18, 2026

Copy link
Copy Markdown

@bamiebot-maker 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

@k-deejah
k-deejah merged commit aa43504 into Sorokit:main Oct 18, 2026
4 checks passed
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.

Prevent event bubbling and add responsive address truncation in WalletConnectButton

2 participants