-
Notifications
You must be signed in to change notification settings - Fork 13.4k
fix(list): remove border from last item with item-sliding #28439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
55feb0c
49a3d34
2aff234
c11f03a
169a75e
c5d9418
9a45cde
56247db
2d264db
21a5ba9
3a63aec
8c1989b
7a00cfc
127e374
1c83d15
448b88c
057988c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -23,12 +23,50 @@ | |||||||||||||||||||||
@include border-radius($list-inset-md-border-radius); | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
.list-md.list-inset ion-item:first-child { | ||||||||||||||||||||||
/** | ||||||||||||||||||||||
* These selectors ensure the first item in the list | ||||||||||||||||||||||
* has the correct radius. | ||||||||||||||||||||||
* We need to consider the following scenarios: | ||||||||||||||||||||||
1. The first item in a list as long as it is not the only item. | ||||||||||||||||||||||
2. The item in the first item-sliding in a list. | ||||||||||||||||||||||
* Note that we do not select "ion-item-sliding ion-item:first-of-type" | ||||||||||||||||||||||
* because that will cause the borders to disappear on | ||||||||||||||||||||||
* items in an item-sliding when the item is the first | ||||||||||||||||||||||
* element in the item-sliding container. | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
.list-md.list-inset ion-item:not(:only-of-type):first-of-type, | ||||||||||||||||||||||
.list-md.list-inset ion-item-sliding:first-of-type ion-item { | ||||||||||||||||||||||
--border-radius: #{$list-inset-md-border-radius $list-inset-md-border-radius 0 0}; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
.list-md.list-inset ion-item:last-child { | ||||||||||||||||||||||
--border-radius: #{0 0 $list-inset-md-border-radius, $list-inset-md-border-radius}; | ||||||||||||||||||||||
/** | ||||||||||||||||||||||
* These selectors ensure the last item in the list | ||||||||||||||||||||||
* has the correct radius and border. | ||||||||||||||||||||||
* We need to consider the following scenarios: | ||||||||||||||||||||||
1. The last item in a list as long as it is not the only item. | ||||||||||||||||||||||
2. The item in the last item-sliding in a list. | ||||||||||||||||||||||
* Note that we do not select "ion-item-sliding ion-item:last-of-type" | ||||||||||||||||||||||
* because that will cause the borders to disappear on | ||||||||||||||||||||||
* items in an item-sliding when the item is the last | ||||||||||||||||||||||
* element in the item-sliding container. | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
.list-md.list-inset ion-item:not(:only-of-type):last-of-type, | ||||||||||||||||||||||
.list-md.list-inset ion-item-sliding:last-of-type ion-item { | ||||||||||||||||||||||
--border-radius: #{0 0 $list-inset-md-border-radius $list-inset-md-border-radius}; | ||||||||||||||||||||||
--border-width: 0; | ||||||||||||||||||||||
--inner-border-width: 0; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
||||||||||||||||||||||
/** | ||||||||||||||||||||||
* The only item in a list should have a border radius | ||||||||||||||||||||||
* on all corners. | ||||||||||||||||||||||
* We target :only-child instead of :only-of-type | ||||||||||||||||||||||
* otherwise borders will disappear on items inside of | ||||||||||||||||||||||
* ion-item-sliding because the item will be the only | ||||||||||||||||||||||
* one of its type inside of the ion-item-sliding group. | ||||||||||||||||||||||
*/ | ||||||||||||||||||||||
.list-md.list-inset ion-item:only-child { | ||||||||||||||||||||||
--border-radius: #{$list-inset-md-border-radius}; | ||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change seems wrong to me:
Steps to reproduce:
- <ion-content id="content" color="light">
+ <ion-content id="content" color="tertiary">
+ <ion-list inset>
+ <ion-item>
+ <ion-label>Text Items</ion-label>
+ </ion-item>
+ </ion-list>
+
<ion-list inset> Add the following <style>
ion-item {
--background: red;
}
</style> Increase the border radius on $list-inset-md-border-radius: 10px !default; There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm just following what was there before for border radius: ionic-framework/core/src/components/list/list.md.scss Lines 26 to 33 in a455147
Demo: https://codepen.io/liamdebeasi/pen/eYxzXjw Note that the last-child's border radius never showed up because it was formatted incorrectly: (either everything should have a comma, or nothing should) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm okay. I think this might be broken behavior then on Material Design 3 also has this padding at the top and bottom of their list. Should we create a tech debt ticket to take a look at this or add it to our MD3 work? It does look like it should still have this code on |
||||||||||||||||||||||
--border-width: 0; | ||||||||||||||||||||||
--inner-border-width: 0; | ||||||||||||||||||||||
} | ||||||||||||||||||||||
|
Uh oh!
There was an error while loading. Please reload this page.