Skip to content
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

[form-layout] Form item label does not align with vaadin-text-field label #1166

Open
jouni opened this issue Feb 14, 2018 · 4 comments
Open
Labels
bug Something isn't working vaadin-form-layout workaround There is a workaround in the comments.

Comments

@jouni
Copy link
Member

jouni commented Feb 14, 2018

screen shot 2018-02-14 at 14 33 06

<vaadin-form-layout responsive-steps='[{"columns": 2, "labelsPosition": "top"}]'>
  <vaadin-combo-box label="Label" placeholder="Placeholder"></vaadin-combo-box>
  <vaadin-form-item>
    <label slot="label">Options</label>
    <div>
      <vaadin-checkbox checked>Checked</vaadin-checkbox>
      <vaadin-checkbox>Unchecked</vaadin-checkbox>
    </div>
  </vaadin-form-item>
</vaadin-form-layout>

A similar baseline fix, which is used in vaadin-text-field, should be applied for the form item label as well (when labelsPosition=='top').

@jouni
Copy link
Member Author

jouni commented Feb 14, 2018

Not sure if this is worth fixing. It probably can’t be fixed so that it works in all possible cases (e.g. when using the small theme for vaadin-text-field), but maybe worth fixing so that the most common use case works as expected?

@jouni
Copy link
Member Author

jouni commented Feb 14, 2018

As a workaround, use align-self: flex-start; for the form item:

<vaadin-form-item style="align-self: flex-start;">

screen shot 2018-02-14 at 14 38 54

@platosha
Copy link
Contributor

but maybe worth fixing so that the most common use case works as expected?

I think so.

Since the baseline shift in <vaadin-text-field> is introduced by the Lumo theme, the fix for this should be applied in Lumo theme too.

@manolo
Copy link
Member

manolo commented Mar 26, 2018

We have this problem In Bakery. We need to hide a field when there is a new order and show it when editing the order, but the visual result does not align with other fields in the form, as you can see in the next screenshot when changing the display property:

new-order

This is the same case here, with the difference that we have a <vaadin-form-layout> inside instead of a <vaadin-form-item>.

The workaround in Bakery is to set <vaadin-form-layout style="align-self: flex-start;">

manolo referenced this issue in vaadin/bakery-app-starter-flow-spring Mar 26, 2018
Using first item label, instead of `vaadin-form-item` prevents misaligin labels
See: https://github.com/vaadin/vaadin-form-layout/issues/63

At the same time make dueDate and dueTime stay in the same line
when there is enough room
@vaadin-bot vaadin-bot transferred this issue from vaadin/vaadin-form-layout May 19, 2021
@vaadin-bot vaadin-bot added bug Something isn't working vaadin-form-layout labels May 19, 2021
@web-padawan web-padawan changed the title Form item label does not align with vaadin-text-field label [form-item] Label does not align with vaadin-text-field label May 20, 2021
@web-padawan web-padawan changed the title [form-item] Label does not align with vaadin-text-field label [form-layout] Form item label does not align with vaadin-text-field label May 28, 2021
@web-padawan web-padawan added the workaround There is a workaround in the comments. label Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working vaadin-form-layout workaround There is a workaround in the comments.
Projects
None yet
Development

No branches or pull requests

5 participants