Skip to content

fix!: style form-item required indicator in base styles#11435

Draft
DiegoCardoso wants to merge 1 commit intomainfrom
fix/form-layout/base-styles-required-indicator
Draft

fix!: style form-item required indicator in base styles#11435
DiegoCardoso wants to merge 1 commit intomainfrom
fix/form-layout/base-styles-required-indicator

Conversation

@DiegoCardoso
Copy link
Copy Markdown
Contributor

@DiegoCardoso DiegoCardoso commented Apr 1, 2026

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 opacity based on the [required] attribute. After this change, it toggles the display value between inline-block and none instead. To mitigate the visual impact on label-less <vaadin-form-item>, a min-height: 1lh is added to [part=label].

Base

localhost_8000_dev_form-layout html_theme=base%3Alight

Aura

localhost_8000_dev_form-layout html_theme=aura%3Alight (2)

Lumo

localhost_8000_dev_form-layout html_theme=lumo%3Alight

Type of change

  • Bugfix

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].
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Apr 1, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure which approach would be better for the Lumo theme:

  1. Add styles to override the base style changes
  2. 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

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.

1 participant