Skip to content
Open
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
3 changes: 2 additions & 1 deletion core/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1228,7 +1228,8 @@ export class Select implements ComponentInterface {
* TODO(FW-5592): Remove hasStartEndSlots condition
*/
const labelShouldFloat =
labelPlacement === 'stacked' || (labelPlacement === 'floating' && (hasValue || isExpanded || hasStartEndSlots));
labelPlacement === 'stacked' ||
(labelPlacement === 'floating' && (hasValue || hasFocus || isExpanded || hasStartEndSlots));

return (
<Host
Expand Down
16 changes: 16 additions & 0 deletions core/src/components/select/test/label/select.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,22 @@ configs().forEach(({ title, screenshot, config }) => {
const select = page.locator('ion-select');
await expect(select).toHaveScreenshot(screenshot(`select-label-floating-no-value-placeholder`));
});
test('label should appear on top of the select when it is focused, has a placeholder, and no value', async ({ page }) => {
await page.setContent(
`
<ion-select label="Label" label-placement="floating" placeholder="Placeholder">
<ion-select-option value="apples">Apples</ion-select-option>
</ion-select>
`,
config
);

const select = page.locator('ion-select');
await select.click();
const cancel = page.locator("button.alert-button-role-cancel");
await cancel.click();
await expect(select).toHaveScreenshot(screenshot(`select-label-focus-floating-no-value-placeholder`));
});
test('label should appear on top of the select when the select is expanded', async ({ page }) => {
await page.setContent(
`
Expand Down
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.
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.
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.
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.