Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions core/src/components/item/item.scss
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,13 @@ button, a {
// shrink and wrap its text instead of moving to its
// own row if there are slotted elements next to it
width: min-content;

/**
* We allow labels in the default
* slot to grow. However, we do not
* want them to grow indefinitely.
*/
max-width: 100%;
}

// Item Input
Expand Down
31 changes: 31 additions & 0 deletions core/src/components/label/test/a11y/label.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,34 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
});
});
});

configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('label: text wrapping in item'), () => {
test('long text should not cause label to expand infinitely', async ({ page }) => {
await page.setContent(
`
<style>
div {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
</style>
<ion-item>
<ion-label>
<!-- This text should be truncated with ellipses -->
<div>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
</div>
</ion-label>
</ion-item>
`,
config
);

const item = page.locator('ion-item');

await expect(item).toHaveScreenshot(screenshot(`label-item-wrap`));
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.