fix!: style form-item required indicator in base styles#11435
fix!: style form-item required indicator in base styles#11435DiegoCardoso wants to merge 1 commit intomainfrom
Conversation
The styles were missing for base styles, which caused it not showing at all for base styles and Aura. The changes introduce a small behavior change: in Lumo, the required indicator would toggle the opacity based on the [required] attribute; after the change, it toggles the display value between inline-block and none. To diminish the visual changes for label-less `form-item`, this adds a `min-height` of `1lh` to the [part=label].
|
There was a problem hiding this comment.
I wasn't sure which approach would be better for the Lumo theme:
- Add styles to override the base style changes
- Adopt the base styles in Lumo, accepting the minor visual differences
I went with (2). The min-height: 1lh on [part=label] is meant to mitigate the layout shift that a label-less <vaadin-form-item> would otherwise have.
Previously in Lumo, the [part=required-indicator] pseudo-element only had its opacity toggled, meaning its intrinsic size still contributed to the [part=label] layout even when no [required] attribute was set on the field component. The new approach toggles display instead, which means that when the field is not required, a <vaadin-form-item> without a label will collapse closer to the line above.
Arguably, this is a side effect of the current styling implementation, and users should define their own spacing. However, it could be perceived as a breaking change if the spacing is suddenly removed in that scenario.
There was a problem hiding this comment.
This is the visual test where the change described in this review comment would be most noticeable. The checkbox in the last row would render without any spacing from the one above it.



Description
The styles were missing from the base theme, which caused the required indicator not to show at all in the base styles and Aura theme
The changes introduce a small behavior difference: in Lumo, the required indicator previously toggled its
opacitybased on the[required]attribute. After this change, it toggles thedisplayvalue betweeninline-blockandnoneinstead. To mitigate the visual impact on label-less<vaadin-form-item>, amin-height: 1lhis added to[part=label].Base
Aura
Lumo
Type of change