mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-19 19:57:22 +08:00
fix(item-options): use correct safe area padding (#27853)
Issue number: Internal --------- <!-- 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. --> Item sliding options in the "start" slot use the "left" safe area padding on the end edge. This causes the padding to be added in the wrong place. During development I also discovered that the RTL padding was wrong for both start and end options. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> LTR: - `side="start"` options set "left" safe area padding on left edge of first child - `side="end"` options set "right" safe area padding on right edge of last child RTL: - `side="start"` options set "right" safe area padding on right edge of first child - `side="end"` options set "left" safe area padding on the left edge of the last child ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> | side prop/text direction | `main` | `branch` | | - | - | - | | start/LTR |  |  | | end/LTR |  |  | | start/RTL |  |  | | end/RTL |  |  |
This commit is contained in:
@ -56,15 +56,17 @@ ion-item-options {
|
||||
}
|
||||
}
|
||||
|
||||
.item-options-start ion-item-option:first-child {
|
||||
@include padding-horizontal(null, var(--ion-safe-area-left));
|
||||
|
||||
/* stylelint-disable property-disallowed-list */
|
||||
[dir="ltr"] .item-options-start ion-item-option:first-child,
|
||||
[dir="rtl"] .item-options-start ion-item-option:last-child {
|
||||
padding-left: var(--ion-safe-area-left);
|
||||
}
|
||||
|
||||
.item-options-end ion-item-option:last-child {
|
||||
@include padding-horizontal(null, var(--ion-safe-area-right));
|
||||
|
||||
[dir="ltr"] .item-options-end ion-item-option:last-child,
|
||||
[dir="rtl"] .item-options-end ion-item-option:first-child {
|
||||
padding-right: var(--ion-safe-area-right);
|
||||
}
|
||||
/* stylelint-enable property-disallowed-list */
|
||||
|
||||
.item-sliding-active-slide {
|
||||
@include rtl() {
|
||||
|
@ -45,6 +45,14 @@ export class ItemOptions implements ComponentInterface {
|
||||
// Used internally for styling
|
||||
[`item-options-${mode}`]: true,
|
||||
|
||||
/**
|
||||
* Note: The "start" and "end" terms refer to the
|
||||
* direction ion-item-option instances within ion-item-options flow.
|
||||
* They do not refer to how ion-item-options flows within ion-item-sliding.
|
||||
* As a result, "item-options-start" means the ion-item-options container
|
||||
* always appears on the left, and "item-options-end" means the ion-item-options
|
||||
* container always appears on the right.
|
||||
*/
|
||||
'item-options-start': !isEnd,
|
||||
'item-options-end': isEnd,
|
||||
}}
|
||||
|
Reference in New Issue
Block a user