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
21 changes: 15 additions & 6 deletions core/src/components/select/select.scss
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,15 @@ button {
box-sizing: border-box;
}

.select-wrapper .select-placeholder {
/**
* When the floating label appears on top of the
* select, we need to fade the text out so that the
* label does not overlap with the placeholder.
*/
transition: opacity 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

// Select Highlight
// ----------------------------------------------------------------

Expand Down Expand Up @@ -473,16 +482,17 @@ button {
}

/**
* The select should be hidden when the label
* The placeholder should be hidden when the label
* is on top of the select. This prevents the label
* from overlapping any placeholder value.
*/
:host(.select-label-placement-floating:not(.has-placeholder)) .native-wrapper .select-text {
:host(.select-label-placement-floating) .native-wrapper .select-placeholder {
opacity: 0;
}

:host(.select-expanded.select-label-placement-floating) .native-wrapper .select-text,
:host(.has-value.select-label-placement-floating) .native-wrapper .select-text {
:host(.select-expanded.select-label-placement-floating) .native-wrapper .select-placeholder,
:host(.ion-focused.select-label-placement-floating) .native-wrapper .select-placeholder,
:host(.has-value.select-label-placement-floating) .native-wrapper .select-placeholder {
opacity: 1;
}

Expand All @@ -492,8 +502,7 @@ button {
:host(.select-label-placement-stacked) .label-text-wrapper,
:host(.select-expanded.select-label-placement-floating) .label-text-wrapper,
:host(.ion-focused.select-label-placement-floating) .label-text-wrapper,
:host(.has-value.select-label-placement-floating) .label-text-wrapper,
:host(.has-placeholder.select-label-placement-floating) .label-text-wrapper {
:host(.has-value.select-label-placement-floating) .label-text-wrapper {
@include transform(translateY(50%), scale(#{$select-floating-label-scale}));

/**
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.
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,19 @@ configs().forEach(({ title, screenshot, config }) => {
const textarea = page.locator('ion-textarea');
expect(await textarea.screenshot()).toMatchSnapshot(screenshot(`textarea-placement-floating-no-value`));
});
test('label should appear on top of the textarea when there is a placeholder and no value', async ({ page }) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

During development I discovered we did not have test coverage for this same behavior on ion-textarea, so I added it. ion-input has test coverage already.

await page.setContent(
`
<ion-textarea label="Standard" label-placement="floating" placeholder="Placeholder"></ion-textarea>
`,
config
);

const textarea = page.locator('ion-textarea');
expect(await textarea.screenshot()).toMatchSnapshot(
screenshot(`textarea-placement-floating-no-value-placeholder`)
);
});
test('label should appear on top of the textarea when the textarea is focused', 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.