Skip to content

fix: perf(accessibility): fix iOS accessibility in Bridge token selector c…#29128

Merged
javiergarciavera merged 13 commits into
mainfrom
perf/bridge-accessibility
May 27, 2026
Merged

fix: perf(accessibility): fix iOS accessibility in Bridge token selector c…#29128
javiergarciavera merged 13 commits into
mainfrom
perf/bridge-accessibility

Conversation

@javiergarciavera
Copy link
Copy Markdown
Contributor

@javiergarciavera javiergarciavera commented Apr 21, 2026

…omponents

  • BridgeTokenSelector, TokenButton, TokenSelectorItem: Pressable → TouchableOpacity

Description

Changelog

CHANGELOG entry:

Related issues

Fixes:

Manual testing steps

Feature: my feature name

  Scenario: user [verb for user action]
    Given [describe expected initial app state]

    When user [verb for user action]
    Then [describe expected outcome]

Screenshots/Recordings

Before

After

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Low Risk
UI-only changes to Bridge token list rendering and accessibility; no auth, transactions, or API contract changes.

Overview
Improves Bridge token selector scrolling performance and iOS VoiceOver behavior without changing selection or balance logic.

BridgeTokenSelector tunes the token list: ESTIMATED_ITEM_HEIGHT is 68 (documented from padding/avatar sizes), and the FlatList gets initialNumToRender, maxToRenderPerBatch, windowSize, and removeClippedSubviews to cut over-rendering on long lists.

TokenSelectorItem wraps the row in React.memo, hoists shared balance text styles, and sets accessible={false} on inner Box layouts so the row’s TouchableOpacity stays the single focusable control on iOS. Balance rows pass explicit textVariant / textColor instead of spreading style objects.

TokenButton drops the Box wrapper: layout moves onto TouchableOpacity’s pillContainer style so the pill is one simpler touch target.

Reviewed by Cursor Bugbot for commit 7185cac. Bugbot is set up for automated code reviews on this repo. Configure here.

@javiergarciavera javiergarciavera requested a review from a team as a code owner April 21, 2026 15:44
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

Comment thread app/components/UI/Bridge/components/TokenSelectorItem.tsx Outdated
@javiergarciavera javiergarciavera force-pushed the perf/bridge-accessibility branch from 19ce599 to aba8226 Compare April 21, 2026 16:17
@github-actions github-actions Bot added size-M risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 21, 2026
Comment thread app/components/UI/Bridge/components/TokenSelectorItem.tsx Outdated
Comment thread app/components/UI/Bridge/components/BridgeTokenSelector/BridgeTokenSelector.tsx Outdated
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.21%. Comparing base (d824f4c) to head (aba8226).
⚠️ Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
...ponents/UI/Bridge/components/TokenSelectorItem.tsx 83.33% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29128      +/-   ##
==========================================
- Coverage   82.21%   82.21%   -0.01%     
==========================================
  Files        5079     5079              
  Lines      133881   133889       +8     
  Branches    30031    30032       +1     
==========================================
+ Hits       110071   110076       +5     
- Misses      16332    16334       +2     
- Partials     7478     7479       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 21, 2026
Comment thread app/components/UI/Bridge/components/TokenSelectorItem.tsx
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 21, 2026
bfullam
bfullam previously approved these changes Apr 27, 2026
@javiergarciavera javiergarciavera force-pushed the perf/bridge-accessibility branch from 9ca4da0 to 7e4f08f Compare May 13, 2026 14:48
javiergarciavera and others added 3 commits May 13, 2026 16:53
…omponents

- BridgeTokenSelector, TokenButton, TokenSelectorItem: Pressable → TouchableOpacity

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ge token selector

- TokenSelectorItem: fix BOTTOM_ROW_BALANCE_TEXT_STYLE to use BodySM
  (was accidentally changed to BodyMD when extracting the inline constant),
  restoring visual alignment with the BodySM token name on the same row
- BridgeTokenSelector: remove getItemLayout since items have variable
  heights due to conditional badges and labels — fixed offsets cause
  scroll position jumps with non-uniform items

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The custom comparator omitted children, networkImageSource, and several
token sub-properties. When children (e.g. the info ButtonIcon) gets a
new reference due to a parent re-render, the memo would block the
re-render leaving a stale closure. Use default shallow comparison
instead.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@javiergarciavera javiergarciavera force-pushed the perf/bridge-accessibility branch from 7e4f08f to b7fd64e Compare May 13, 2026 15:00
@javiergarciavera javiergarciavera added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label May 13, 2026
@javiergarciavera javiergarciavera changed the title perf(accessibility): fix iOS accessibility in Bridge token selector c… fix: perf(accessibility): fix iOS accessibility in Bridge token selector c… May 13, 2026
@javiergarciavera javiergarciavera added the team-swaps-and-bridge Swaps and Bridge team label May 13, 2026
Comment thread app/components/UI/Bridge/components/TokenSelectorItem.tsx Outdated
Comment thread app/components/UI/Bridge/components/TokenSelectorItem.tsx Outdated
infiniteflower
infiniteflower previously approved these changes May 14, 2026
…lanceView

When inlining the balance text style logic, tokenBalanceTextProps overrides
were incorrectly applied to FiatBalanceView instances too. Only TokenBalanceView
should receive the caller-supplied text overrides (variant/color/style); fiat
balance views must always use the plain base constants.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 08b4c18. Configure here.

Comment thread app/components/UI/Bridge/components/TokenSelectorItem.tsx Outdated
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

javiergarciavera and others added 3 commits May 19, 2026 17:05
The local redefinition shadowed the imported util and referenced
parseAmount which was never imported, causing a potential runtime error.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@javiergarciavera javiergarciavera added this pull request to the merge queue May 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 27, 2026
@javiergarciavera javiergarciavera added this pull request to the merge queue May 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 27, 2026
@javiergarciavera javiergarciavera added this pull request to the merge queue May 27, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 27, 2026
@javiergarciavera javiergarciavera added this pull request to the merge queue May 27, 2026
@javiergarciavera javiergarciavera removed this pull request from the merge queue due to a manual request May 27, 2026
@javiergarciavera javiergarciavera added this pull request to the merge queue May 27, 2026
@javiergarciavera javiergarciavera removed this pull request from the merge queue due to a manual request May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeSwap, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: low
  • AI Confidence: 90%
click to see 🤖 AI reasoning details

E2E Test Selection:
The three changed files are all within the Bridge UI component directory and involve:

  1. BridgeTokenSelector.tsx: Minor constant adjustment (ESTIMATED_ITEM_HEIGHT 72→68) and FlatList performance props (initialNumToRender, maxToRenderPerBatch, windowSize, removeClippedSubviews). These are standard React Native FlatList optimizations that improve rendering performance without changing behavior.

  2. TokenButton.tsx: Refactoring that removes the Box wrapper and moves flex styles directly into the StyleSheet pillContainer. The visual output is identical — same layout, same styles, just simplified JSX structure.

  3. TokenSelectorItem.tsx: Performance optimizations — moving inline style objects to module-level constants (avoids re-creation on each render), adding accessible={false} to Box components, and wrapping the component with React.memo. Also refactors tokenBalanceTextProps spreading to explicit prop passing.

These changes are scoped entirely to the Bridge token selector UI. They are low-risk refactoring and performance improvements with no logic changes, no API changes, and no controller/Engine modifications.

SmokeSwap is selected because it directly covers swap and bridge trading flows, including the token selector UI that was modified.
SmokeConfirmations is selected per the SmokeSwap tag description which states: "When selecting SmokeSwap, also select SmokeConfirmations (transaction confirmations are part of the flow)."

No other tags are needed as the changes are isolated to Bridge UI components with no impact on accounts, networks, identity, snaps, browser, or other wallet features.

Performance Test Selection:
While the changes include FlatList performance optimizations (initialNumToRender, maxToRenderPerBatch, windowSize, removeClippedSubviews) and React.memo wrapping in the Bridge token selector, these are targeted micro-optimizations within a specific UI component. The available performance test tags (@PerformanceSwaps, @PerformanceLaunch, etc.) measure broader flow-level performance metrics rather than individual component render optimizations. The changes are unlikely to produce measurable differences in the performance test suite's timing metrics, and no performance test infrastructure was modified. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@javiergarciavera javiergarciavera added this pull request to the merge queue May 27, 2026
Merged via the queue into main with commit 69fc281 May 27, 2026
503 of 513 checks passed
@javiergarciavera javiergarciavera deleted the perf/bridge-accessibility branch May 27, 2026 18:35
@github-actions github-actions Bot locked and limited conversation to collaborators May 27, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.80.0 Issue or pull request that will be included in release 7.80.0 label May 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-7.80.0 Issue or pull request that will be included in release 7.80.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-M team-swaps-and-bridge Swaps and Bridge team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants