KEMBAR78
refactor!: update MSCB to not use combo-box extension internally by web-padawan · Pull Request #9804 · vaadin/web-components · GitHub
Skip to content

Conversation

@web-padawan
Copy link
Member

@web-padawan web-padawan commented Jul 25, 2025

Description

Fixes #9719

Depends on #9805

The base visual tests change is valid: the input-field part is now a flex child (previously, that wasn't working for MSCB because of an extra vaadin-multi-select-combo-box-internal wrapper - ideally it would need display: contents).
I'm not sure if we need that visual test as the original fix #6721 was Lumo specific, but I'm ok to keep it.

Type of change

  • Breaking change

Note

Flow components branch: https://github.com/vaadin/flow-components/compare/proto/mscb-combo-box-mixins

@web-padawan web-padawan force-pushed the refactor/mscb-combo-box-mixins branch from 3e769af to 271f88c Compare July 25, 2025 13:13
id="clearButton"
part="clear-button"
slot="suffix"
@touchend="${this._onClearButtonTouchend}"
Copy link
Member Author

Choose a reason for hiding this comment

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

This was added in #4141. It should't be needed anymore as _onClearAction() will call clear() and that method will be used from the combo-box base mixin. I will keep the test checking that items are cleared on touchend though.

@web-padawan web-padawan force-pushed the refactor/mscb-combo-box-mixins branch from 271f88c to b4c595f Compare July 28, 2025 09:30
expect(comboBox.selectedItems).to.deep.equal([]);
});

it('should not clear selected items on Esc when clear button is visible and opened', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a new test that covers current behavior on main branch. I updated _onEscape accordingly - previously it was working differently. Now we call super._onEscape in MSCB so I needed to adjust the logic.

@web-padawan web-padawan force-pushed the refactor/mscb-combo-box-mixins branch from b4c595f to 5d4979d Compare July 28, 2025 09:35
}
:host([opened]) {
pointer-events: auto;
Copy link
Member Author

Choose a reason for hiding this comment

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

Base styles for MSCB already have this as they extend combo-box base styles.

@web-padawan web-padawan force-pushed the refactor/mscb-combo-box-mixins branch 2 times, most recently from 6c24a14 to 46f2f42 Compare July 28, 2025 09:43
@web-padawan web-padawan marked this pull request as ready for review July 28, 2025 11:29
@web-padawan web-padawan requested a review from sissbruecker July 28, 2025 11:29
@web-padawan web-padawan force-pushed the refactor/mscb-combo-box-mixins branch from 42c27a7 to b4314b4 Compare July 28, 2025 11:46
@web-padawan web-padawan force-pushed the refactor/mscb-combo-box-mixins branch from b4314b4 to 1effecb Compare July 28, 2025 11:50
expect(inputElement.value).to.equal('');
});

it('should clear the filter when pressing escape with autoOpenDisabled', async () => {
Copy link
Member Author

Choose a reason for hiding this comment

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

Added a missing test that covers current behavior on main branch.

it('should clear selected items on clear button touchend', () => {
comboBox.selectedItems = ['apple', 'orange'];
clearButton.dispatchEvent(new CustomEvent('touchend', { cancelable: true }));
fire(clearButton, 'touchend');
Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to use fire() which makes event bubble, as the combo-box listener is on the host element.

@sonarqubecloud
Copy link

@web-padawan web-padawan merged commit fabaed5 into main Jul 29, 2025
12 of 13 checks passed
@web-padawan web-padawan deleted the refactor/mscb-combo-box-mixins branch July 29, 2025 08:05
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 25.0.0-beta2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[multi-select-combo-box] Refactor to not use combo-box extension element internally

3 participants