Skip to content

Conversation

@jouni
Copy link
Member

@jouni jouni commented Oct 14, 2025

  • Change all field components to use CSS grid layout on the host.
  • Make the internal .vaadin-*-container elements irrelevant with display: contents.
  • Use a pseudo element to set the baseline alignment of fields, while keeping support for multiline labels.

This change removes the ability to globally set "helper-above-field" variant on all fields with the --vaadin-input-field-helper-order property. Might still be possible with the new custom properties, but might require two properties instead of one.

Before

Screenshot 2025-10-15 at 11 40 01

After

Screenshot 2025-10-15 at 11 39 35

jouni added 2 commits October 14, 2025 10:40
The container element is no longer meaningful.
@jouni jouni force-pushed the refactor/baseline-alignment branch from 8e954af to d0f6061 Compare October 14, 2025 07:40
--_has-helper: ;
--_no-error: initial;
--_has-error: ;
display: inline-grid;
Copy link
Contributor

Choose a reason for hiding this comment

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

General question: would this also help to get us common features like "help-icon" next to the label or field? It's a pretty common UX pattern seen where people want to place an (i) icon on the right side of the label or on the right side of the field which people could click or hover to get more informations.

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 it might, as the label isn't restricted to one line and truncated with an ellipsis, so it should be easier to render custom content in the label slot. But I don't know how feasible that is in general, regarding accessibility.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah.. I'm also talking more about a slot next to the label.. ;) I don't think it would be a good fit within the label

Copy link
Member Author

@jouni jouni Oct 14, 2025

Choose a reason for hiding this comment

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

Right. I don't see why that couldn't be a similar thing as the required indicator, sitting inside the part=label element.

@jouni jouni marked this pull request as ready for review October 15, 2025 08:41
@sonarqubecloud
Copy link

.vaadin-custom-field-container {
width: 100%;
}
const customField = css``;
Copy link
Member

Choose a reason for hiding this comment

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

We don't need empty customField, IMO it can be removed so that we could use this instead:

export const customFieldStyles = [field];

Copy link
Member

Choose a reason for hiding this comment

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

Just to double check, is this screenshot change intended (empty space below inputs)? The custom field with only native inputs isn't the most common use case so it's probably not a blocker.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, it’s intended, although maybe not desired. It’s the alignment pseudo element that creates that space, assuming the minimum input field height of the Vaadin components.

</div>
<div class="slots">
<div part="input-fields">
Copy link
Member

Choose a reason for hiding this comment

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

Could be extracted into separate PR marked as feat: so that we could mention this in release notes.

Comment on lines +21 to +26
grid-template-rows:
var(--_helper-below-field, var(--_has-label, auto 0) 1fr var(--_has-helper, auto) var(--_has-error, auto))
var(
--_helper-above-field,
var(--_has-label, auto) var(--_has-helper, auto) var(--_has-label, 0) 1fr var(--_has-error, 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.

As discussed in the daily, we might try to use grid-template-areas instead, see if that makes the code easier to understand.

Copy link
Member Author

Choose a reason for hiding this comment

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

Another thing we discussed is to use margins instead of gap for the space between the parts. Then we wouldn't need to worry about empty grid cells creating unnecessary gaps, and could reduce the "logic" with the internal custom properties.

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.

4 participants