Skip to content

fix(select): hide notch cutout if no visible label provided #27649

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 15, 2023
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.scss
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ button {
* then the element should be hidden otherwise
* there will be additional margins added.
*/
.label-text-wrapper-hidden {
.label-text-wrapper-hidden,
.select-outline-notch-hidden {
display: none;
}

Expand Down
7 changes: 6 additions & 1 deletion core/src/components/select/select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -910,7 +910,12 @@ export class Select implements ComponentInterface {
return [
<div class="select-outline-container">
<div class="select-outline-start"></div>
<div class="select-outline-notch">
<div
class={{
'select-outline-notch': true,
'select-outline-notch-hidden': !this.hasLabel,
}}
>
<div class="notch-spacer" aria-hidden="true" ref={(el) => (this.notchSpacerEl = el)}>
{this.label}
</div>
Expand Down
13 changes: 13 additions & 0 deletions core/src/components/select/test/fill/select.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,4 +224,17 @@ configs({ modes: ['md'], directions: ['ltr'] }).forEach(({ title, screenshot, co
expect(await select.screenshot()).toMatchSnapshot(screenshot(`select-fill-outline-hidden-slotted-label`));
});
});
test.describe(title('select: notch cutout'), () => {
test('notch cutout should be hidden when no label is passed', async ({ page }) => {
await page.setContent(
`
<ion-select fill="outline" label-placement="stacked" aria-label="my select"></ion-select>
`,
config
);

const notchCutout = page.locator('ion-select .select-outline-notch');
await expect(notchCutout).toBeHidden();
});
});
});