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
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
24 changes: 24 additions & 0 deletions core/src/components/select/test/label/select.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,3 +377,27 @@ configs({ modes: ['ios'], directions: ['ltr'] }).forEach(({ title, config }) =>
});
});
});

/**
* This behavior does not vary across modes/directions
*/
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
test.describe(title('select: floating label focus'), () => {
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 page.locator('ion-select button').focus();
await expect(select).toHaveScreenshot(screenshot(`select-label-floating-focus-no-value-placeholder`));
});
});
});
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