Skip to content

experiment: add multi-select-combo-box base styles and visual tests #9608

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 18 commits into from
Jul 4, 2025

Conversation

jouni
Copy link
Member

@jouni jouni commented Jul 2, 2025

Screenshot 2025-07-02 at 9 37 48

Supported custom properties

The chip properties are not “scoped” to the just MSCB, as this component might be useful in the future in other places as well.

Property  Description
--vaadin-chip-min-width
--vaadin-chip-gap Gap between the label and the remove button.
--vaadin-chip-padding 0.3em
--vaadin-chip-background
--vaadin-chip-color
--vaadin-chip-font-size
--vaadin-chip-font-weight
--vaadin-chip-height Chip height is explicitly defined so that it’s the same as the line-height of the MSCB input.
--vaadin-chip-border-radius
--vaadin-chip-border-width
--vaadin-chip-border-color
--vaadin-chip-remove-button-color

@jouni jouni requested review from web-padawan and anezthes July 2, 2025 06:43
@web-padawan web-padawan force-pushed the experiment/base-mscb branch from 35a623a to de8c921 Compare July 2, 2025 08:41
@@ -27,6 +27,7 @@ class MultiSelectComboBoxContainer extends InputContainer {
display: flex;
width: 100%;
min-width: 0;
gap: var(--_wrapper-gap);
Copy link
Member

Choose a reason for hiding this comment

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

Added reset for this custom CSS property to Lumo as otherwise it breaks visual tests.
Moving this CSS to styles folder is also an option but that sounds like an overkill.

@web-padawan
Copy link
Member

web-padawan commented Jul 2, 2025

Something is wrong about chip min-width, here's how it looks on the narrow viewport (doesn't happen with Lumo).
Seems related to using min(max-content, var(--vaadin-chip-min-width, 6em)); - should we revert this change?

Screenshot 2025-07-02 at 12 50 28

Note: the --_chip-min-width custom CSS property name is a bit counter-intuitive as it isn't actually used for min-width property on the chips. Instead, it's used in JS calculation to detect at which point the chip should be moved to overflow.

UPD: the actual problem is that we incorrectly assume the value to be in px while the new one is in em instead.

@web-padawan
Copy link
Member

@jouni I ended up changing --vaadin-chip-min-width to 48px for now, and reported #9616. We can update to use your original 6rem value in a separate PR once this is fixed, but in some use cases like inside grid our users want to see chips that are quite narrow, so I wanted to pick something similar to the current 50px default. WDYT about this?

@web-padawan web-padawan force-pushed the experiment/base-mscb branch from 309b8d9 to 71c7867 Compare July 2, 2025 10:31
@jouni
Copy link
Member Author

jouni commented Jul 2, 2025

Yeah, that’s good. I think I didn't fully understand the behavior of how the sizes are computed and how the min-widths affect that.

@@ -69,7 +69,6 @@ import { MultiSelectComboBoxMixin } from './vaadin-multi-select-combo-box-mixin.
* `--vaadin-field-default-width` | Default width of the field | `12em`
* `--vaadin-multi-select-combo-box-overlay-width` | Width of the overlay | `auto`
* `--vaadin-multi-select-combo-box-overlay-max-height` | Max height of the overlay | `65vh`
* `--vaadin-multi-select-combo-box-chip-min-width` | Min width of the chip | `50px`
Copy link
Member

@web-padawan web-padawan Jul 2, 2025

Choose a reason for hiding this comment

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

This is now only used by Lumo so I think we should either remove it from API docs (as it has no effect on base styles) or make a separate PR for renaming it also in core / Lumo styles. Not sure which is better.

Copy link
Member Author

Choose a reason for hiding this comment

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

I suppose we could also keep it working in base styles, but remove it from the docs or mark it deprecated.

Copy link
Member

Choose a reason for hiding this comment

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

I restored it for now to avoid unintentional breaking change but IMO it's ok to remove it from API docs.

@jouni
Copy link
Member Author

jouni commented Jul 2, 2025

I think we need to go through the JSDocs of all components and update the custom property lists. For example, I didn't add properties for multi-select-combo-box specifically, it just uses the same as combo-box.

@web-padawan
Copy link
Member

Good point about API docs. Created #9617, will link actual PRs with base styles to that issue.

@web-padawan web-padawan force-pushed the experiment/base-mscb branch 2 times, most recently from 8b91a23 to 7d88fb0 Compare July 2, 2025 12:55
@web-padawan web-padawan force-pushed the experiment/base-mscb branch from b286e8b to 1cc873a Compare July 2, 2025 13:39
Copy link
Member

@web-padawan web-padawan left a comment

Choose a reason for hiding this comment

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

LGTM but it would be good to have another review as I also made some modifications in the PR.

@jouni jouni requested review from vursen and removed request for anezthes July 2, 2025 15:51
Copy link

sonarqubecloud bot commented Jul 2, 2025

@web-padawan web-padawan requested a review from DiegoCardoso July 3, 2025 11:52
@web-padawan web-padawan removed the request for review from vursen July 4, 2025 09:53
@web-padawan web-padawan merged commit 2a04128 into main Jul 4, 2025
12 of 13 checks passed
@web-padawan web-padawan deleted the experiment/base-mscb branch July 4, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants