Skip to content

Commit 8cb8786

Browse files
authored
fix(many): add correct scale to stacked labels (#28163)
1 parent 53203db commit 8cb8786

File tree

154 files changed

+145
-31
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+145
-31
lines changed

core/src/components/checkbox/checkbox.scss

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,12 +278,28 @@ input {
278278
}
279279

280280
:host(.checkbox-label-placement-stacked) .label-text-wrapper {
281+
@include transform(scale(#{$form-control-label-stacked-scale}));
282+
281283
/**
282284
* The margin between the label and
283285
* the checkbox should be on the bottom
284286
* when the label sits at the top.
285287
*/
286288
@include margin(null, 0, $form-control-label-margin, 0);
289+
290+
/**
291+
* Label text should not extend
292+
* beyond the bounds of the checkbox.
293+
*/
294+
max-width: calc(100% / #{$form-control-label-stacked-scale});
295+
}
296+
297+
:host(.checkbox-label-placement-stacked.checkbox-alignment-start) .label-text-wrapper {
298+
@include transform-origin(start, top);
299+
}
300+
301+
:host(.checkbox-label-placement-stacked.checkbox-alignment-center) .label-text-wrapper {
302+
@include transform-origin(center, top);
287303
}
288304

289305
// Checked / Indeterminate Checkbox

core/src/components/checkbox/test/label/checkbox.e2e.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,3 +166,19 @@ configs().forEach(({ title, screenshot, config }) => {
166166
});
167167
});
168168
});
169+
170+
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, config, screenshot }) => {
171+
test.describe(title('checkbox: stacked long label'), () => {
172+
test('long label should truncate', async ({ page }) => {
173+
await page.setContent(
174+
`
175+
<ion-checkbox label-placement="stacked" alignment="start" style="width: 200px">Enable Notifications Enable Notifications Enable Notifications Enable Notifications Enable Notifications Enable Notifications Enable Notifications</ion-checkbox>
176+
`,
177+
config
178+
);
179+
180+
const checkbox = page.locator('ion-checkbox');
181+
await expect(checkbox).toHaveScreenshot(screenshot(`checkbox-label-stacked-long-label`));
182+
});
183+
});
184+
});

0 commit comments

Comments
 (0)