Skip to content

FormLayout responsiveness fails with Dialog when line break used #1055

@TatuLund

Description

@TatuLund

Use the code below.

Size the browser window to be narrow and click Open dialog button.

image

Dialog opens, all looks good

image

Start dragging Browser window wider, first things looks ok, and responsiveness works

image

But when you drag it wide enough, the 5th field is misplaced.

import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.dialog.Dialog;
import com.vaadin.flow.component.formlayout.FormLayout;
import com.vaadin.flow.component.formlayout.FormLayout.ResponsiveStep;
import com.vaadin.flow.component.orderedlayout.HorizontalLayout;
import com.vaadin.flow.component.textfield.TextField;
import com.vaadin.flow.dom.ElementFactory;
import com.vaadin.flow.router.Route;

@Route("formissue")
public class FormIssue extends HorizontalLayout {
    public FormIssue() {
        Dialog confDialog = new Dialog();
        FormLayout binderForm = new FormLayout();
        binderForm.setResponsiveSteps(
                new ResponsiveStep("32em", 1),
                new ResponsiveStep("40em", 2),
                new ResponsiveStep("50em", 3));

        TextField aField = new TextField();
        aField.setPlaceholder("1");
        TextField bField = new TextField();
        bField.setPlaceholder("2");
        TextField cField = new TextField();
        cField.setPlaceholder("3");
        TextField dField = new TextField();
        dField.setPlaceholder("4");
        TextField eField = new TextField();
        eField.setPlaceholder("5");
        TextField fField = new TextField();
        fField.setPlaceholder("6");
        TextField gField = new TextField();
        gField.setPlaceholder("7");

        binderForm.add(aField);
        binderForm.add(bField);
        binderForm.add(cField);
        binderForm.add(dField);
        binderForm.getElement().appendChild(ElementFactory.createBr());
        binderForm.add(eField);
        binderForm.add(fField);
        binderForm.add(gField);

        confDialog.add(binderForm);
        confDialog.setResizable(true);

        Button openDialog = new Button("Open dialog");
        openDialog.addClickListener(event -> {
          confDialog.open();

        });
        add(openDialog);        
    }
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions