Skip to content

Commit f89d756

Browse files
CR + remove now unnecessary vertical-align
1 parent 67df737 commit f89d756

17 files changed

+23
-24
lines changed

core/api.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1857,7 +1857,7 @@ ion-radio-group,prop,value,any,undefined,false,false
18571857
ion-radio-group,event,ionChange,RadioGroupChangeEventDetail<any>,true
18581858
ion-radio-group,part,error-text
18591859
ion-radio-group,part,helper-text
1860-
ion-radio-group,part,top
1860+
ion-radio-group,part,supporting-text
18611861

18621862
ion-range,shadow
18631863
ion-range,prop,activeBarStart,number | undefined,undefined,false,false

core/src/components/radio-group/radio-group.common.scss

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33

44
:host {
55
display: block;
6-
7-
// Prevents additional pixels from being rendered on top
8-
vertical-align: top;
96
}
107

118
// Radio Group: Top

core/src/components/radio-group/radio-group.ionic.scss

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,20 +23,16 @@
2323

2424
// Add padding to the error and helper text when used in a
2525
// list to align them with the list header and item text.
26-
// Note: :host-context() cannot be nested inside ltr()/rtl() mixins
27-
// because the mixin tries to transform the selector, creating invalid CSS.
28-
// We work around this by using separate rules outside the mixins.
29-
/* stylelint-disable */
30-
:host-context(ion-list) .radio-group-top {
31-
// Default to LTR - padding-left includes safe area
32-
padding-right: globals.$ion-space-400;
33-
padding-left: calc(globals.$ion-space-400 + var(--ion-safe-area-left, 0px));
26+
:host(.in-list) .radio-group-top {
27+
/* stylelint-disable */
28+
@include globals.ltr() {
29+
padding-right: globals.$ion-space-400;
30+
padding-left: calc(globals.$ion-space-400 + var(--ion-safe-area-left, 0px));
31+
}
32+
33+
@include globals.rtl() {
34+
padding-right: calc(globals.$ion-space-400 + var(--ion-safe-area-right, 0px));
35+
padding-left: globals.$ion-space-400;
36+
}
37+
/* stylelint-enable */
3438
}
35-
36-
// RTL support - match when document or ancestor has dir="rtl"
37-
:host-context([dir="rtl"] ion-list) .radio-group-top,
38-
:host-context(ion-list) .radio-group-top:dir(rtl) {
39-
padding-right: calc(globals.$ion-space-400 + var(--ion-safe-area-right, 0px));
40-
padding-left: globals.$ion-space-400;
41-
}
42-
/* stylelint-enable */

core/src/components/radio-group/radio-group.ios.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
// Add padding to the error and helper text when used in a
99
// list to align them with the list header and item text.
10-
:host-context(ion-list) .radio-group-top {
10+
:host(.in-list) .radio-group-top {
1111
@include padding-horizontal($item-ios-padding-start, $item-ios-padding-end);
1212
}

core/src/components/radio-group/radio-group.md.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77

88
// Add padding to the error and helper text when used in a
99
// list to align them with the list header and item text.
10-
:host-context(ion-list) .radio-group-top {
10+
:host(.in-list) .radio-group-top {
1111
@include padding-horizontal($item-md-padding-start, $item-md-padding-end);
1212
}

core/src/components/radio-group/radio-group.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,15 @@ import { renderHiddenInput } from '@utils/helpers';
66
import { getIonTheme } from '../../global/ionic-global';
77

88
import type { RadioGroupChangeEventDetail, RadioGroupCompareFn } from './radio-group-interface';
9+
import {hostContext} from "@utils/theme";
910

1011
/**
1112
* @virtualProp {"ios" | "md"} mode - The mode determines the platform behaviors of the component.
1213
* @virtualProp {"ios" | "md" | "ionic"} theme - The theme determines the visual appearance of the component.
14+
*
15+
* @part supporting-text - Supporting text displayed above the radios.
16+
* @part helper-text - Supporting text displayed above the radios when the radio group is valid.
17+
* @part error-text - Supporting text displayed above the radios when the radio group is invalid and touched.
1318
*/
1419
@Component({
1520
tag: 'ion-radio-group',
@@ -353,6 +358,7 @@ export class RadioGroup implements ComponentInterface {
353358
<Host
354359
class={{
355360
[theme]: true,
361+
'in-list': hostContext('ion-list', el),
356362
}}
357363
role="radiogroup"
358364
aria-labelledby={label ? labelId : null}

core/src/components/radio-group/test/supporting-text/radio-group.e2e.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
197197
await page.setContent(
198198
`
199199
<style>
200-
ion-radio-group::part(top) {
200+
ion-radio-group::part(supporting-text) {
201201
font-size: 20px;
202202
}
203203
@@ -222,7 +222,7 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
222222
await page.setContent(
223223
`
224224
<style>
225-
ion-radio-group::part(top) {
225+
ion-radio-group::part(supporting-text) {
226226
font-size: 20px;
227227
}
228228
Loading
Loading
Loading

0 commit comments

Comments
 (0)