diff --git a/core/src/components/item/item.scss b/core/src/components/item/item.scss index 2fd10f3b61e..a6abde0100d 100644 --- a/core/src/components/item/item.scss +++ b/core/src/components/item/item.scss @@ -80,6 +80,15 @@ position: relative; + // When an item containing a select is inside of a + // flex container the item will collapse to 0px + // width due to the select setting the width to 0px. + // By setting the flex property here, we are + // allowing the item to grow to fill the flex container. + // If the item is inside of a block container this + // property will be ignored. + flex: 1; + align-items: center; justify-content: space-between; diff --git a/core/src/components/select/test/item/select.e2e.ts b/core/src/components/select/test/item/select.e2e.ts index 913c0ddca2e..4e4ff55ca22 100644 --- a/core/src/components/select/test/item/select.e2e.ts +++ b/core/src/components/select/test/item/select.e2e.ts @@ -41,5 +41,21 @@ configs({ directions: ['ltr'] }).forEach(({ title, screenshot, config }) => { const list = page.locator('ion-list'); await expect(list).toHaveScreenshot(screenshot(`select-inset-list-no-fill`)); }); + test('should render correctly in an item inside of a flex container', async ({ page }) => { + await page.setContent( + ` +
+ + + Apple + + +
+ `, + config + ); + const container = page.locator('#container'); + await expect(container).toHaveScreenshot(screenshot(`select-item-flex-container`)); + }); }); }); diff --git a/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Chrome-linux.png b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..a2f57d86e19 Binary files /dev/null and b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Firefox-linux.png b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..ccfdf7e0f63 Binary files /dev/null and b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Safari-linux.png b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..b8f98d9c50b Binary files /dev/null and b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-ios-ltr-Mobile-Safari-linux.png differ diff --git a/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Chrome-linux.png b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Chrome-linux.png new file mode 100644 index 00000000000..826eb3694a0 Binary files /dev/null and b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Chrome-linux.png differ diff --git a/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Firefox-linux.png b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Firefox-linux.png new file mode 100644 index 00000000000..1fce4d97ce6 Binary files /dev/null and b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Firefox-linux.png differ diff --git a/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Safari-linux.png b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Safari-linux.png new file mode 100644 index 00000000000..46149555013 Binary files /dev/null and b/core/src/components/select/test/item/select.e2e.ts-snapshots/select-item-flex-container-md-ltr-Mobile-Safari-linux.png differ