setExpandRatio to a Progress Bar ---> disaster

I have an HorizontalLayout with two components inside: a button and a progress bar.

As I want the ProgressBar to take all the space left available in the Layout after the button has been drawn (taking all the space it needed to), I did a myHLayout.setExpandRatio(myProgressBar, 1.0f). Please correct me if I did something wrong, but plenty times I’ve used this technique.

Well, the approach seems to work well at first glance. But when I click the button, which in turn starts the progress bar (from full to empty), then it suddenly expands to almost double its size, getting out of the container.

The method used for updating the progress bar is the well-known one setting a value to it each time the runner is run (which happens once a second), calculated by dividing the current amount of seconds since last refresh by 60, until it reaches also 60 and it restarts, so I think this doesn’t have anything to do with the strange behaviour.

Affirmative. That’s bug.

https://github.com/vaadin/framework/issues/9723

Thanks for your reply, Ilia.

By the way, my workaround for this was to wrap the progressbar in a VerticalLayout; I set the width of my bar to 90% (I didn’t want to fill all the space) and the expandRatio of the wraper to 1 and this time it works like expected.

Thanks for the workaround.