Label is missing when zero expansion ratio.

Hi,
in the following code, the Label TWO is not shown in the screen, but if I change it for a button, it is shown. Is this a bug?

HorizontalLayout layout = new HorizontalLayout();
layout.setSizeFull();

Label one = new Label("One");
Label two = new Label("Two");

layout.addComponent(one);
layout.setExpandRatio(one, 1f);

layout.addComponent(two);
layout.setExpandRatio(two, 0f);

I am using version 7.2.6

The Label is by default 100% wide and 100% of 0 is 0 :slight_smile:

Use Label.setSizeUndefined() to get the label visible again.

Many thanks John,

I identified it was something to do with the size but I thought it was already undefined. But didn’t want to set one.