Skip to content

Commit b2dc4a2

Browse files
authored
fix: fixes recipient modal long text overflow (#38454)
## **Description** The destination account picker modal was experiencing horizontal overflow when account names were long (e.g., external addresses used as names). This created a poor UX with horizontal scrolling. The fix adds proper overflow handling to the account name container: - Added `overflow: hidden`, `flex: 1`, and `minWidth: 0` to the Column containing the name (the `minWidth: 0` is key for flex children to allow shrinking below content size) - Added `overflow: hidden` to the Row - Added explicit `textOverflow: ellipsis` to the Text component - Added `flexShrink: 0` to the checkmark icon so it doesn't get squished Now long account names are properly truncated with an ellipsis instead of causing overflow. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/MetaMask/metamask-extension/pull/38454?quickstart=1) ## **Changelog** CHANGELOG entry: Fixed recipient modal overflow when account names are long ## **Related issues** Fixes: #38107 ## **Manual testing steps** 1. Create or import an account with a very long name (or use an external address as an account name) 2. Go to the Bridge page 3. Select a non-EVM chain (Bitcoin or Solana) as the destination 4. Open the destination account picker modal 5. Verify that long account names are truncated with an ellipsis instead of causing horizontal overflow 6. Verify the modal layout looks clean without horizontal scrolling ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Prevents horizontal overflow in the destination account picker by constraining flex children and adding ellipsis truncation; updates snapshots accordingly. > > - **UI (Destination account picker)**: > - In `ui/pages/bridge/prepare/components/destination-account-list-item.tsx`: > - Add `style={{ overflow: 'hidden', flex: 1, minWidth: 0 }}` to `Column` wrapping the name. > - Set `Row` to `style={{ overflow: 'hidden' }}` and `Text` to `style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}` with `ellipsis` prop. > - Prevent check icon from shrinking via `style={{ flexShrink: 0 }}`. > - **Tests**: > - Update snapshots in `__snapshots__/destination-account-picker-modal.test.tsx.snap` to reflect new overflow, flex, and ellipsis styles. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 17f58cd. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent 1c19782 commit b2dc4a2

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

ui/pages/bridge/prepare/components/__snapshots__/destination-account-picker-modal.test.tsx.snap

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,19 +135,22 @@ exports[`DestinationAccountPickerModal should render the modal when an account i
135135
<div
136136
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-column mm-box--width-full"
137137
data-testid="selected-to-account"
138+
style="overflow: hidden; flex: 1; min-width: 0;"
138139
>
139140
<div
140141
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-row mm-box--flex-wrap-nowrap mm-box--justify-content-space-between mm-box--align-items-center"
141-
style="max-width: min-content;"
142+
style="overflow: hidden;"
142143
>
143144
<p
144145
class="mm-box mm-text mm-text--body-md-medium mm-text--ellipsis mm-box--color-text-default"
146+
style="overflow: hidden; text-overflow: ellipsis;"
145147
>
146148
Ledger Account 1
147149
</p>
148150
<svg
149151
class="inline-block w-5 h-5 text-primary-default"
150152
fill="currentColor"
153+
style="flex-shrink: 0;"
151154
viewBox="0 0 24 24"
152155
xmlns="http://www.w3.org/2000/svg"
153156
>
@@ -243,13 +246,15 @@ exports[`DestinationAccountPickerModal should render the modal when an account i
243246
</div>
244247
<div
245248
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-column mm-box--width-full"
249+
style="overflow: hidden; flex: 1; min-width: 0;"
246250
>
247251
<div
248252
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-row mm-box--flex-wrap-nowrap mm-box--justify-content-space-between mm-box--align-items-center"
249-
style="max-width: min-content;"
253+
style="overflow: hidden;"
250254
>
251255
<p
252256
class="mm-box mm-text mm-text--body-md-medium mm-text--ellipsis mm-box--color-text-default"
257+
style="overflow: hidden; text-overflow: ellipsis;"
253258
>
254259
Account 1
255260
</p>
@@ -341,13 +346,15 @@ exports[`DestinationAccountPickerModal should render the modal when an account i
341346
</div>
342347
<div
343348
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-column mm-box--width-full"
349+
style="overflow: hidden; flex: 1; min-width: 0;"
344350
>
345351
<div
346352
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-row mm-box--flex-wrap-nowrap mm-box--justify-content-space-between mm-box--align-items-center"
347-
style="max-width: min-content;"
353+
style="overflow: hidden;"
348354
>
349355
<p
350356
class="mm-box mm-text mm-text--body-md-medium mm-text--ellipsis mm-box--color-text-default"
357+
style="overflow: hidden; text-overflow: ellipsis;"
351358
>
352359
Account 2
353360
</p>
@@ -531,13 +538,15 @@ exports[`DestinationAccountPickerModal should render the modal when no account i
531538
</div>
532539
<div
533540
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-column mm-box--width-full"
541+
style="overflow: hidden; flex: 1; min-width: 0;"
534542
>
535543
<div
536544
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-row mm-box--flex-wrap-nowrap mm-box--justify-content-space-between mm-box--align-items-center"
537-
style="max-width: min-content;"
545+
style="overflow: hidden;"
538546
>
539547
<p
540548
class="mm-box mm-text mm-text--body-md-medium mm-text--ellipsis mm-box--color-text-default"
549+
style="overflow: hidden; text-overflow: ellipsis;"
541550
>
542551
Ledger Account 1
543552
</p>
@@ -629,13 +638,15 @@ exports[`DestinationAccountPickerModal should render the modal when no account i
629638
</div>
630639
<div
631640
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-column mm-box--width-full"
641+
style="overflow: hidden; flex: 1; min-width: 0;"
632642
>
633643
<div
634644
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-row mm-box--flex-wrap-nowrap mm-box--justify-content-space-between mm-box--align-items-center"
635-
style="max-width: min-content;"
645+
style="overflow: hidden;"
636646
>
637647
<p
638648
class="mm-box mm-text mm-text--body-md-medium mm-text--ellipsis mm-box--color-text-default"
649+
style="overflow: hidden; text-overflow: ellipsis;"
639650
>
640651
Account 1
641652
</p>
@@ -727,13 +738,15 @@ exports[`DestinationAccountPickerModal should render the modal when no account i
727738
</div>
728739
<div
729740
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-column mm-box--width-full"
741+
style="overflow: hidden; flex: 1; min-width: 0;"
730742
>
731743
<div
732744
class="mm-box mm-container mm-container--max-width-undefined mm-box--display-flex mm-box--gap-1 mm-box--flex-direction-row mm-box--flex-wrap-nowrap mm-box--justify-content-space-between mm-box--align-items-center"
733-
style="max-width: min-content;"
745+
style="overflow: hidden;"
734746
>
735747
<p
736748
class="mm-box mm-text mm-text--body-md-medium mm-text--ellipsis mm-box--color-text-default"
749+
style="overflow: hidden; text-overflow: ellipsis;"
737750
>
738751
Account 2
739752
</p>

ui/pages/bridge/prepare/components/destination-account-list-item.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,22 @@ const DestinationAccountListItem: React.FC<DestinationAccountListItemProps> = ({
135135
<Column
136136
gap={1}
137137
data-testid={selected ? 'selected-to-account' : undefined}
138+
style={{ overflow: 'hidden', flex: 1, minWidth: 0 }}
138139
>
139-
<Row gap={1} style={{ maxWidth: 'min-content' }}>
140-
<Text variant={TextVariant.bodyMdMedium} ellipsis>
140+
<Row gap={1} style={{ overflow: 'hidden' }}>
141+
<Text
142+
variant={TextVariant.bodyMdMedium}
143+
ellipsis
144+
style={{ overflow: 'hidden', textOverflow: 'ellipsis' }}
145+
>
141146
{account.displayName}
142147
</Text>
143148
{selected && (
144149
<Icon
145150
name={IconName.CheckBold}
146151
size={IconSize.Md}
147152
color={IconColor.PrimaryDefault}
153+
style={{ flexShrink: 0 }}
148154
/>
149155
)}
150156
</Row>

0 commit comments

Comments
 (0)