Skip to content
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

fix: prevent long chips from exceeding available input width #6905

Merged
merged 1 commit into from
Dec 4, 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
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ registerStyles(
#wrapper {
display: flex;
width: 100%;
min-width: 0;
}

:host([auto-expand-vertically]) #wrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ const multiSelectComboBox = css`
flex: 0 1 auto;
}

::slotted([slot='chip']) {
TatuLund marked this conversation as resolved.
Show resolved Hide resolved
overflow: hidden;
}

:host(:is([readonly], [disabled])) ::slotted(input) {
flex-grow: 0;
flex-basis: 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,23 @@ describe('multi-select-combo-box', () => {
element.selectedItems = items;
await visualDiff(div, 'auto-expand-height');
});

it('auto expand long chip', async () => {
element.style.maxWidth = '300px';
const items = [...element.items];
items[0] = 'Super long item that does not fit into input';
element.items = element.selectedItems = [items[0]];
await visualDiff(div, 'auto-expand-long-chip');
});

it('auto expand long chip clear button', async () => {
element.style.maxWidth = '300px';
element.clearButtonVisible = true;
const items = [...element.items];
items[0] = 'Super long item that does not fit into input';
element.items = element.selectedItems = [items[0]];
await visualDiff(div, 'auto-expand-long-chip-clear-button');
});
});

describe('opened', () => {
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.
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,23 @@ describe('multi-select-combo-box', () => {
element.style.maxWidth = '250px';
await visualDiff(div, 'auto-expand-max-width');
});

it('auto expand long chip', async () => {
element.style.maxWidth = '250px';
const items = [...element.items];
items[0] = 'Super long item that does not fit into input';
element.items = element.selectedItems = [items[0]];
await visualDiff(div, 'auto-expand-long-chip');
});

it('auto expand long chip clear button', async () => {
element.style.maxWidth = '250px';
element.clearButtonVisible = true;
const items = [...element.items];
items[0] = 'Super long item that does not fit into input';
element.items = element.selectedItems = [items[0]];
await visualDiff(div, 'auto-expand-long-chip-clear-button');
});
});

describe('opened', () => {
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.