Skip to content

Commit e630595

Browse files
authored
chore: update selected item state background color (MetaMask#23894)
## **Description** Updating most instances of selected item background color to `colors.background.muted` ## **Changelog** CHANGELOG entry:null ## **Related issues** Fixes: Region Picker: https://consensyssoftware.atlassian.net/browse/MDP-280 Network Picker: https://consensyssoftware.atlassian.net/browse/MDP-239 Sort: https://consensyssoftware.atlassian.net/browse/MDP-243 ## **Manual testing steps** ```gherkin 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** ### Network Manager | before | after | | -------- | ------- | | ![before](https://github.com/user-attachments/assets/f1b42b64-fd93-4637-8cc7-221a4c06f701) | ![after](https://github.com/user-attachments/assets/17da788d-b98b-490a-b6eb-b83daa7a9f77) | ### RPC Selection | before | after | | -------- | ------- | | ![before](https://github.com/user-attachments/assets/a2f61ed3-7824-4d50-947e-56009092105f) | ![after](https://github.com/user-attachments/assets/11ac9bf1-944c-4515-ba0e-300b8c8267a2) | ### Sort | before | after | | -------- | ------- | | ![before](https://github.com/user-attachments/assets/526f51e0-66bb-4a06-a624-d7a96d1defbe) | ![after](https://github.com/user-attachments/assets/33ac49a5-5556-4723-bcad-b8e08f79acd5) | ### Payment Selector | before | after | | -------- | ------- | | ![before](https://github.com/user-attachments/assets/d82a614b-9e2e-4360-915e-afd23267120a) | ![after](https://github.com/user-attachments/assets/596288fd-2aaa-43ee-aba6-416dcd6396a0) | ### Region Picker | before | after | | -------- | ------- | | ![before](https://github.com/user-attachments/assets/18557999-e62a-4b46-b329-9a187cd6020a) | ![after](https://github.com/user-attachments/assets/c669f5d9-1f58-473e-a736-13c2bbbcf986) | ### Select Network | before | after | | -------- | ------- | | ![before](https://github.com/user-attachments/assets/e6b0ca02-ce25-4ed1-b9e6-653c3b991ee1) | ![after](https://github.com/user-attachments/assets/9d9f47a6-2b85-4fb1-89e1-d2617c453f26) | ### **Before** `~` ### **After** `~` ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [x] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [x] 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] > Updates selected item visuals across lists/selectors to use `colors.background.muted` and drops the side underlay bar indicator, with snapshots adjusted. > > - **Styling/UX**: > - Use `colors.background.muted` for selected states in `ListItemMultiSelect`, `ListItemSelect`, `ListItemMultiSelectButton`, and downstream UI (account/network/region/token selectors, permissions screens). > - Remove underlay side bar visuals (`underlayBar`, width strip) and related props/tests; retain simple full-row underlay where applicable. > - **Components**: > - `components-temp/ListItemMultiSelectButton`: selected container background updated; removed underlay view rendering; tests simplified (icon/press only). > - `components/List/ListItemSelect`: underlay color changed; removed `underlayBar`; kept minimal `underlay` view. > - `components/List/ListItemMultiSelect`: underlay color changed. > - Remove unused constant `SELECTABLE_ITEM_UNDERLAY_ID`. > - **Tests/Snapshots**: > - Snapshot updates to reflect color change (`#4459ff1a` → `#3c4d9d0f`) and removal of side bar indicator across numerous selector/modal views. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9dbd116. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
1 parent fa777c2 commit e630595

20 files changed

Lines changed: 39 additions & 499 deletions

File tree

app/component-library/components-temp/ListItemMultiSelectButton/ListItemMultiSelectButton.styles.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,6 @@ const styleSheet = (params: {
3333
} as ViewStyle,
3434
style,
3535
) as ViewStyle,
36-
underlay: {
37-
...StyleSheet.absoluteFillObject,
38-
flexDirection: 'row',
39-
backgroundColor: colors.primary.muted,
40-
width: 4,
41-
},
42-
underlayBar: {
43-
marginVertical: 4,
44-
marginLeft: 4,
45-
width: 4,
46-
borderRadius: 2,
47-
backgroundColor: colors.primary.default,
48-
},
4936
listItem: {
5037
paddingRight: 0,
5138
paddingTop: 0,
@@ -69,7 +56,7 @@ const styleSheet = (params: {
6956
},
7057
container: {
7158
backgroundColor: isSelected
72-
? colors.primary.muted
59+
? colors.background.muted
7360
: colors.background.default,
7461
flexDirection: 'row',
7562
alignItems: 'center',

app/component-library/components-temp/ListItemMultiSelectButton/ListItemMultiSelectButton.test.tsx

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,6 @@ describe('ListItemMultiSelectButton', () => {
1818
expect(wrapper).toMatchSnapshot();
1919
});
2020

21-
it('should not render the underlay view if isSelected is false', () => {
22-
const { queryByRole } = render(
23-
<ListItemMultiSelectButton>
24-
<View />
25-
</ListItemMultiSelectButton>,
26-
);
27-
expect(queryByRole('checkbox')).toBeNull();
28-
});
29-
30-
it('should render the underlay view if isSelected is true', () => {
31-
const { queryByRole } = render(
32-
<ListItemMultiSelectButton isSelected>
33-
<View />
34-
</ListItemMultiSelectButton>,
35-
);
36-
expect(queryByRole('checkbox')).not.toBeNull();
37-
});
38-
3921
it('should call onPress when the button is pressed', () => {
4022
const mockOnPress = jest.fn();
4123
const { getByRole } = render(

app/component-library/components-temp/ListItemMultiSelectButton/ListItemMultiSelectButton.tsx

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ const ListItemMultiSelectButton: React.FC<ListItemMultiSelectButtonProps> = ({
5757
<ListItem gap={gap} style={styles.containerColumn}>
5858
{children}
5959
</ListItem>
60-
{isSelected && (
61-
<View style={styles.underlay} accessibilityRole="checkbox" accessible>
62-
<View style={styles.underlayBar} />
63-
</View>
64-
)}
6560
</TouchableOpacity>
6661
{showButtonIcon ? (
6762
<View style={styles.buttonIcon}>

app/component-library/components/List/ListItemMultiSelect/ListItemMultiSelect.styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const styleSheet = (params: {
3838
underlay: {
3939
...StyleSheet.absoluteFillObject,
4040
flexDirection: 'row',
41-
backgroundColor: colors.primary.muted,
41+
backgroundColor: colors.background.muted,
4242
},
4343
checkbox: {
4444
marginRight: 8 - Number(gap),

app/component-library/components/List/ListItemSelect/ListItemSelect.constants.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,6 @@ import { ListItemSelectProps } from './ListItemSelect.types';
88
// Defaults
99
export const DEFAULT_SELECTITEM_GAP = 16;
1010

11-
// Test IDs
12-
export const SELECTABLE_ITEM_UNDERLAY_ID = 'selectable-item-underlay';
13-
1411
// Sample consts
1512
export const SAMPLE_SELECTITEM_PROPS: ListItemSelectProps = {
1613
isSelected: true,

app/component-library/components/List/ListItemSelect/ListItemSelect.styles.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,11 @@ const styleSheet = (params: {
3535
underlay: {
3636
...StyleSheet.absoluteFillObject,
3737
flexDirection: 'row',
38-
backgroundColor: colors.primary.muted,
38+
backgroundColor: colors.background.muted,
3939
},
4040
listItem: {
4141
padding: 16,
4242
},
43-
underlayBar: {
44-
marginVertical: 4,
45-
marginLeft: 4,
46-
width: 4,
47-
borderRadius: 2,
48-
backgroundColor: colors.primary.default,
49-
},
5043
});
5144
};
5245

app/component-library/components/List/ListItemSelect/ListItemSelect.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@ const ListItemSelect: React.FC<ListItemSelectProps> = ({
3939
{children}
4040
</ListItem>
4141
{isSelected && (
42-
<View style={styles.underlay} accessibilityRole="checkbox" accessible>
43-
<View style={styles.underlayBar} />
44-
</View>
42+
<View style={styles.underlay} accessibilityRole="checkbox" accessible />
4543
)}
4644
</TouchableOpacity>
4745
);

app/components/UI/CaipAccountSelectorList/__snapshots__/CaipAccountSelectorList.test.tsx.snap

Lines changed: 4 additions & 116 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ exports[`CaipAccountSelectorList renders all accounts with balances 1`] = `
6868
style={
6969
{
7070
"alignItems": "center",
71-
"backgroundColor": "#4459ff1a",
71+
"backgroundColor": "#3c4d9d0f",
7272
"flexDirection": "row",
7373
}
7474
}
@@ -248,34 +248,6 @@ exports[`CaipAccountSelectorList renders all accounts with balances 1`] = `
248248
</View>
249249
</View>
250250
</View>
251-
<View
252-
accessibilityRole="checkbox"
253-
accessible={true}
254-
style={
255-
{
256-
"backgroundColor": "#4459ff1a",
257-
"bottom": 0,
258-
"flexDirection": "row",
259-
"left": 0,
260-
"position": "absolute",
261-
"right": 0,
262-
"top": 0,
263-
"width": 4,
264-
}
265-
}
266-
>
267-
<View
268-
style={
269-
{
270-
"backgroundColor": "#4459ff",
271-
"borderRadius": 2,
272-
"marginLeft": 4,
273-
"marginVertical": 4,
274-
"width": 4,
275-
}
276-
}
277-
/>
278-
</View>
279251
</TouchableOpacity>
280252
<View
281253
style={
@@ -627,7 +599,7 @@ exports[`CaipAccountSelectorList renders all accounts with right accessory 1`] =
627599
style={
628600
{
629601
"alignItems": "center",
630-
"backgroundColor": "#4459ff1a",
602+
"backgroundColor": "#3c4d9d0f",
631603
"flexDirection": "row",
632604
}
633605
}
@@ -770,34 +742,6 @@ exports[`CaipAccountSelectorList renders all accounts with right accessory 1`] =
770742
</View>
771743
</View>
772744
</View>
773-
<View
774-
accessibilityRole="checkbox"
775-
accessible={true}
776-
style={
777-
{
778-
"backgroundColor": "#4459ff1a",
779-
"bottom": 0,
780-
"flexDirection": "row",
781-
"left": 0,
782-
"position": "absolute",
783-
"right": 0,
784-
"top": 0,
785-
"width": 4,
786-
}
787-
}
788-
>
789-
<View
790-
style={
791-
{
792-
"backgroundColor": "#4459ff",
793-
"borderRadius": 2,
794-
"marginLeft": 4,
795-
"marginVertical": 4,
796-
"width": 4,
797-
}
798-
}
799-
/>
800-
</View>
801745
</TouchableOpacity>
802746
<View
803747
style={
@@ -1112,7 +1056,7 @@ exports[`CaipAccountSelectorList renders correctly 1`] = `
11121056
style={
11131057
{
11141058
"alignItems": "center",
1115-
"backgroundColor": "#4459ff1a",
1059+
"backgroundColor": "#3c4d9d0f",
11161060
"flexDirection": "row",
11171061
}
11181062
}
@@ -1292,34 +1236,6 @@ exports[`CaipAccountSelectorList renders correctly 1`] = `
12921236
</View>
12931237
</View>
12941238
</View>
1295-
<View
1296-
accessibilityRole="checkbox"
1297-
accessible={true}
1298-
style={
1299-
{
1300-
"backgroundColor": "#4459ff1a",
1301-
"bottom": 0,
1302-
"flexDirection": "row",
1303-
"left": 0,
1304-
"position": "absolute",
1305-
"right": 0,
1306-
"top": 0,
1307-
"width": 4,
1308-
}
1309-
}
1310-
>
1311-
<View
1312-
style={
1313-
{
1314-
"backgroundColor": "#4459ff",
1315-
"borderRadius": 2,
1316-
"marginLeft": 4,
1317-
"marginVertical": 4,
1318-
"width": 4,
1319-
}
1320-
}
1321-
/>
1322-
</View>
13231239
</TouchableOpacity>
13241240
<View
13251241
style={
@@ -1671,7 +1587,7 @@ exports[`CaipAccountSelectorList renders network icons for accounts with transac
16711587
style={
16721588
{
16731589
"alignItems": "center",
1674-
"backgroundColor": "#4459ff1a",
1590+
"backgroundColor": "#3c4d9d0f",
16751591
"flexDirection": "row",
16761592
}
16771593
}
@@ -1851,34 +1767,6 @@ exports[`CaipAccountSelectorList renders network icons for accounts with transac
18511767
</View>
18521768
</View>
18531769
</View>
1854-
<View
1855-
accessibilityRole="checkbox"
1856-
accessible={true}
1857-
style={
1858-
{
1859-
"backgroundColor": "#4459ff1a",
1860-
"bottom": 0,
1861-
"flexDirection": "row",
1862-
"left": 0,
1863-
"position": "absolute",
1864-
"right": 0,
1865-
"top": 0,
1866-
"width": 4,
1867-
}
1868-
}
1869-
>
1870-
<View
1871-
style={
1872-
{
1873-
"backgroundColor": "#4459ff",
1874-
"borderRadius": 2,
1875-
"marginLeft": 4,
1876-
"marginVertical": 4,
1877-
"width": 4,
1878-
}
1879-
}
1880-
/>
1881-
</View>
18821770
</TouchableOpacity>
18831771
<View
18841772
style={

0 commit comments

Comments
 (0)