Skip to content

Commit

Permalink
fix: update selected item styles to not limit height (#3548) (#3564)
Browse files Browse the repository at this point in the history
* fix: reset height to make custom items fit

* fix: set correct slotted item height

Co-authored-by: Serhii Kulykov <iamkulykov@gmail.com>
  • Loading branch information
vaadin-bot and web-padawan committed Mar 14, 2022
1 parent a13ce11 commit c1c2da0
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/select/src/vaadin-select-value-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ registerStyles(
margin: 0;
min-width: 0;
width: 0;
height: auto;
}
::slotted(:not([slot])) {
Expand All @@ -23,7 +24,7 @@ registerStyles(
/* placeholder styles */
::slotted(:not([slot]):not([selected])) {
line-height: normal;
line-height: 1;
}
/* TODO: unsupported selector */
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions packages/select/test/visual/lumo/select.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,24 @@ describe('select', () => {
await visualDiff(div, 'value-overflow');
});

it('value-custom', async () => {
element.renderer = (root) => {
root.innerHTML = `
<vaadin-list-box>
<vaadin-item value="custom">
<div>
Line 1
<br>
Line 2
</div>
</vaadin-item>
</vaadin-list-box>
`;
};
element.value = 'custom';
await visualDiff(div, 'value-custom');
});

it('required', async () => {
element.label = 'Label';
element.required = true;
Expand Down
9 changes: 8 additions & 1 deletion packages/select/theme/lumo/vaadin-select-styles.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const select = css`
:host([theme~='small']) [part='input-field'] ::slotted([slot='value']) {
--lumo-button-size: var(--lumo-size-s);
--_lumo-selected-item-padding: 0;
}
`;

Expand All @@ -54,8 +55,8 @@ registerStyles(
'vaadin-select-value-button',
css`
:host {
min-height: var(--lumo-size-m);
padding: 0 0.25em;
--_lumo-selected-item-padding: 0.5em;
}
:host::before,
Expand All @@ -67,6 +68,12 @@ registerStyles(
box-shadow: none;
}
::slotted(:not([slot])) {
min-height: var(--lumo-button-size);
padding-top: var(--_lumo-selected-item-padding);
padding-bottom: var(--_lumo-selected-item-padding);
}
::slotted(:not([slot]):hover) {
background-color: transparent;
}
Expand Down

0 comments on commit c1c2da0

Please sign in to comment.