fix(input, textarea): input does not block floating label (#27870)
Issue number: resolves #27812 --------- <!-- Please do not submit updates to dependencies unless it fixes an issue. --> <!-- Please try to limit your pull request to one type (bugfix, feature, etc). Submit multiple pull requests if needed. --> ## What is the current behavior? <!-- Please describe the current behavior that you are modifying. --> We currently have CSS to ensure the floating/stacked label is not obscured by the input/textarea when using the outline styles. However, it was discovered that this scenario can happen with any floating/stacked label not just when the input/textarea is using the outline style. ## What is the new behavior? <!-- Please describe the behavior or changes that are being added by this PR. --> - Floating/stacked labels appear on top of the input/textarea regardless of fill mode. ## Does this introduce a breaking change? - [ ] Yes - [x] No <!-- If this introduces a breaking change, please describe the impact and migration path for existing applications below. --> ## Other information <!-- Any other information that is important to this PR such as screenshots of how the component looks before and after the change. --> Dev build: `7.2.1-dev.11690464203.1b2b4419` --------- Co-authored-by: ionitron <hi@ionicframework.com>
@ -82,8 +82,6 @@
|
||||
:host(.input-fill-outline) .label-text-wrapper,
|
||||
:host(.input-fill-outline) .label-text-wrapper {
|
||||
position: relative;
|
||||
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -581,6 +581,13 @@
|
||||
@include transform-origin(start, top);
|
||||
|
||||
max-width: 100%;
|
||||
|
||||
/**
|
||||
* The 2 ensures the label
|
||||
* remains on top of any browser
|
||||
* autofill background too.
|
||||
*/
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -186,9 +186,6 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
|
||||
expect(await input.screenshot()).toMatchSnapshot(screenshot(`input-label-slot-truncate`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, config }) => {
|
||||
test.describe(title('input: async label'), () => {
|
||||
test('input should re-render when label slot is added async', async ({ page }) => {
|
||||
await page.setContent(
|
||||
@ -213,4 +210,27 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
|
||||
expect(await input.screenshot()).toMatchSnapshot(screenshot(`input-async-label`));
|
||||
});
|
||||
});
|
||||
test.describe(title('input: floating/stacked label layering'), () => {
|
||||
test('label should not be covered by text field', async ({ page }, testInfo) => {
|
||||
testInfo.annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/ionic-team/ionic-framework/issues/27812',
|
||||
});
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
.custom-input .native-wrapper {
|
||||
background: pink;
|
||||
}
|
||||
</style>
|
||||
<ion-input class="custom-input" label="My Label" label-placement="stacked"></ion-input>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const input = page.locator('ion-input');
|
||||
|
||||
expect(await input.screenshot()).toMatchSnapshot(screenshot(`input-label-layering`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
After Width: | Height: | Size: 4.7 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 4.4 KiB |
@ -302,4 +302,27 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
|
||||
await expect(page.locator('.container')).toHaveScreenshot(screenshot(`textarea-multi-line-sizing`));
|
||||
});
|
||||
});
|
||||
test.describe(title('textarea: floating/stacked label layering'), () => {
|
||||
test('label should not be covered by text field', async ({ page }, testInfo) => {
|
||||
testInfo.annotations.push({
|
||||
type: 'issue',
|
||||
description: 'https://github.com/ionic-team/ionic-framework/issues/27812',
|
||||
});
|
||||
await page.setContent(
|
||||
`
|
||||
<style>
|
||||
.custom-textarea .native-wrapper {
|
||||
background: pink;
|
||||
}
|
||||
</style>
|
||||
<ion-textarea class="custom-textarea" label="My Label" label-placement="stacked"></ion-textarea>
|
||||
`,
|
||||
config
|
||||
);
|
||||
|
||||
const textarea = page.locator('ion-textarea');
|
||||
|
||||
expect(await textarea.screenshot()).toMatchSnapshot(screenshot(`textarea-label-layering`));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 4.7 KiB |
@ -82,8 +82,6 @@
|
||||
:host(.textarea-fill-outline) .label-text-wrapper,
|
||||
:host(.textarea-fill-outline) .label-text-wrapper {
|
||||
position: relative;
|
||||
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -629,6 +629,13 @@
|
||||
@include padding(0px);
|
||||
|
||||
max-width: 100%;
|
||||
|
||||
/**
|
||||
* The 2 ensures the label
|
||||
* remains on top of any browser
|
||||
* autofill background too.
|
||||
*/
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
/**
|
||||
|