Skip to content

Commit dbaaa5b

Browse files
fix(list): remove uneeded border radius from items in inset list (#28830)
Issue number: N/A --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> In MD mode, items in an inset list currently receive their own border radius, separate from the border radius also applied to the inset list itself. The original intent was likely to ensure that the corners of the items don't spill out of the list. However, the item's border radius is no longer needed, for two reasons: 1. MD has since added top/bottom padding to their lists ([spec](https://m2.material.io/components/lists#specs)), which we've mirrored. This means the borders no longer line up anyway. 2. Even if a developer removes the list's vertical padding (we set it on the host [here](https://github.com/ionic-team/ionic-framework/blob/535b8ed72486a1e94125c72b12d5b447b630f8c4/core/src/components/list/list.md.scss#L9), so it's easy to overwrite), inset lists currently have `overflow: hidden` set [here](https://github.com/ionic-team/ionic-framework/blob/535b8ed72486a1e94125c72b12d5b447b630f8c4/core/src/components/list/list.scss#L20), so the list's border radius still applies correctly even with the items' border radius removed. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> Item border radius in inset lists removed. When testing locally, you may find it useful to increase the MD border radius value [here](https://github.com/ionic-team/ionic-framework/blob/535b8ed72486a1e94125c72b12d5b447b630f8c4/core/src/components/list/list.md.vars.scss#L47) so it's easier to see. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change: 1. Describe the impact and migration path for existing applications below. 3. Update the BREAKING.md file with the breaking change. 4. Add "BREAKING CHANGE: [...]" to the commit description when merging. See https://github.com/ionic-team/ionic-framework/blob/main/.github/CONTRIBUTING.md#footer for more information. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. -->
1 parent b7adede commit dbaaa5b

File tree

1 file changed

+1
-21
lines changed

1 file changed

+1
-21
lines changed

core/src/components/list/list.md.scss

+1-21
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,9 @@
2323
@include border-radius($list-inset-md-border-radius);
2424
}
2525

26-
/**
27-
* These selectors ensure the first item in the list
28-
* has the correct radius.
29-
* We need to consider the following scenarios:
30-
1. The first item in a list as long as it is not the only item.
31-
2. The item in the first item-sliding in a list.
32-
* Note that we do not select "ion-item-sliding ion-item:first-of-type"
33-
* because that will cause the borders to disappear on
34-
* items in an item-sliding when the item is the first
35-
* element in the item-sliding container.
36-
*/
37-
.list-md.list-inset ion-item:not(:only-of-type):first-of-type,
38-
.list-md.list-inset ion-item-sliding:first-of-type ion-item {
39-
--border-radius: #{$list-inset-md-border-radius $list-inset-md-border-radius 0 0};
40-
}
41-
4226
/**
4327
* These selectors ensure the last item in the list
44-
* has the correct radius and border.
28+
* has the correct border.
4529
* We need to consider the following scenarios:
4630
1. The last item in a list as long as it is not the only item.
4731
2. The item in the last item-sliding in a list.
@@ -52,21 +36,17 @@
5236
*/
5337
.list-md.list-inset ion-item:not(:only-of-type):last-of-type,
5438
.list-md.list-inset ion-item-sliding:last-of-type ion-item {
55-
--border-radius: #{0 0 $list-inset-md-border-radius $list-inset-md-border-radius};
5639
--border-width: 0;
5740
--inner-border-width: 0;
5841
}
5942

6043
/**
61-
* The only item in a list should have a border radius
62-
* on all corners.
6344
* We target :only-child instead of :only-of-type
6445
* otherwise borders will disappear on items inside of
6546
* ion-item-sliding because the item will be the only
6647
* one of its type inside of the ion-item-sliding group.
6748
*/
6849
.list-md.list-inset ion-item:only-child {
69-
--border-radius: #{$list-inset-md-border-radius};
7050
--border-width: 0;
7151
--inner-border-width: 0;
7252
}

0 commit comments

Comments
 (0)