0

For part of our UI, the main div is disabled and then more components are added based on the data loaded. However, if the main div is disabled before adding the additional components, then only some of the additional components added have the disabled attribute set.

Have tried Vaadin 23.0.10 and 23.1.0rc1 with Java 17.

Example code:

        VerticalLayout vlMain = new VerticalLayout();
        vlMain.setSizeFull();
        HorizontalLayout hlOne = new HorizontalLayout(FontAwesome.Solid.BUG.create(), new Button("Testing"));
        HorizontalLayout hlTwo = new HorizontalLayout();
        hlOne.setEnabled(false);
        hlTwo.setEnabled(false);
        Button add = new Button("Add");
        add.addClickListener(buttonClickEvent -> {
            if(buttonClickEvent.isFromClient())
            {
                hlTwo.add(FontAwesome.Solid.BUG.create());
                hlTwo.add(new Button("Testing"));
            }
        });
        vlMain.add(hlOne, hlTwo, add);

When the above is run, hlOne contains 2 disabled controls. Clicking the button adds the additional components, however the icon doesn't inherit the disabled attribute but the button does. Calling hlTwo.setEnabled(false) again then sets everything correctly. This can be verified using the browser inspector.

While there is the workaround, it would be good to know what the expected behaviour should be.

Thanks.

AISDev
  • 35
  • 4

0 Answers0