refactor: move column borders variant to base styles - #12575
Conversation
|
vaadin-review-bot
left a comment
There was a problem hiding this comment.
Reviewed the changes — left 1 comment.
| Finding | |
|---|---|
| 🧪 | No test covers the actual point of the change: the custom property winning over the variant's 1px default |
|
The idea was that base styles would have an opinion what the default border configuration would be for any given theme. So a theme can choose, for example, to set both row and column borders by default on all grids, and offer a variant that removes the borders. I suppose it doesn't matter if we move these variants to be in base styles. They just might not do anything for such themes, which have borders enabled by default. It’s the same case for many other variants as well, so it doesn't matter. |
|
There’s an alternative way of fixing this in Aura: aura/grid.css :root {
--_aura-grid-col-border-width: var(--vaadin-grid-column-border-width, 1px);
}
:is(vaadin-grid, vaadin-crud, vaadin-grid-pro)[theme~='column-borders'] {
--vaadin-grid-column-border-width: var(--_aura-grid-col-border-width);
} |
|
With the alternative the prop would only work when you define it in a rule on |
|
Yeah, that’s true. |



Description
Part of #11163
When using the
column-borderstheme variant, Aura currently sets--vaadin-grid-column-border-widthto1px, overriding the application defined property. What is not obvious is that if you set--vaadin-grid-column-border-widthyou don't actually needcolumn-borders, so it is reasonable to assume that someone might fall into this trap of setting both and then wondering why the custom prop is not working.This moves the theme variant to the base styles, similar to several other grid theme variants that are already defined there. That way Aura does not have to override the custom prop,
column-bordersguarantees at least a 1px column border in both base styles and Aura, and--vaadin-grid-column-border-widthis still respected even if you have the theme variant active.There is technically a behavior change for custom slotted grids in a Crud component. But defining grid theme variants on the Crud itself doesn't seem to be a documented use case, there is no Flow API for it, and it goes against the theme propagation logic in Crud which only propagates theme variants if the grid is the default one.
Type of change