mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 03:00:58 +08:00
fix(radio, checkbox, toggle): add top and bottom margins when in ion-item (#27788)
Issue number: Resolves #27498 --------- <!-- 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. --> When `ion-radio`, `ion-checkbox`, or `ion-toggle` is used within `ion-item`, top and bottom margins are not added to the label, while they are present when using the legacy syntax. We didn't catch this because the issue is only visible when using a label that breaks onto more than one line; otherwise, the height of the item exceeds what the margins would've added. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> Margins added. Values were taken from `ion-item` styles [here](096d9cc931/core/src/components/item/item.ios.scss (L203-L206)
) and [here](096d9cc931/core/src/components/item/item.md.scss (L298-L301)
), which no longer get applied because the `ion-label` is nested in an additional shadow component. Note that left/right margins are already included in the modern syntax labels. ## 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. --> This PR is a combination of the following: - https://github.com/ionic-team/ionic-framework/pull/27771 - https://github.com/ionic-team/ionic-framework/pull/27783 - https://github.com/ionic-team/ionic-framework/pull/27784 --------- Co-authored-by: ionitron <hi@ionicframework.com> Co-authored-by: Liam DeBeasi <liamdebeasi@users.noreply.github.com>
This commit is contained in:
@ -1,4 +1,5 @@
|
||||
@import "../../themes/ionic.globals";
|
||||
@import "./checkbox.vars.scss";
|
||||
|
||||
// Checkbox
|
||||
// --------------------------------------------------
|
||||
@ -103,6 +104,10 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
:host(.in-item:not(.legacy-checkbox)) .label-text-wrapper {
|
||||
@include margin($checkbox-item-label-margin-top, null, $checkbox-item-label-margin-bottom, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* If no label text is placed into the slot
|
||||
* then the element should be hidden otherwise
|
||||
@ -194,7 +199,7 @@ input {
|
||||
* the checkbox should be on the end
|
||||
* when the label sits at the start.
|
||||
*/
|
||||
@include margin(0, $form-control-label-margin, 0, 0);
|
||||
@include margin(null, $form-control-label-margin, null, 0);
|
||||
}
|
||||
|
||||
|
||||
@ -215,7 +220,7 @@ input {
|
||||
* when the label sits at the end.
|
||||
*/
|
||||
:host(.checkbox-label-placement-end) .label-text-wrapper {
|
||||
@include margin(0, 0, 0, $form-control-label-margin);
|
||||
@include margin(null, 0, null, $form-control-label-margin);
|
||||
}
|
||||
|
||||
|
||||
@ -228,7 +233,7 @@ input {
|
||||
* the checkbox should be on the end
|
||||
* when the label sits at the start.
|
||||
*/
|
||||
@include margin(0, $form-control-label-margin, 0, 0);
|
||||
@include margin(null, $form-control-label-margin, null, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user