RFR: 8377153: JavaFX FlowPane layout causing improper wrapping of TextFlow nodes with max-width styling

Alessadro Parisi duke at openjdk.org
Wed Feb 25 11:29:08 UTC 2026


On Wed, 25 Feb 2026 07:52:50 GMT, Alessadro Parisi <duke at openjdk.org> wrote:

>> Hey, I'm not sure if my issue is related in some way to this, but text wrapping behavior seems to have changed from JavaFX 24 to 25.
>> I have this:
>> 
>> var bottom = new Label(description);
>> bottom.getStyleClass().add("description");
>> var vbox = new VBox(top, bottom);
>> 
>> And this piece of CSS:
>> 
>> .description {
>>     -fx-padding: 0.5em 0 0 0;
>>     -fx-font-size: 1.083333em;
>>     -fx-wrap-text: true;
>> }
>> 
>> 
>> After updating to JavaFX 25 the text is truncated. Before it would take as much height as needed to show all the text.
>> 
>> Sorry if this is OT, I tried searching for any commit that may have caused this but could not find anything.
>> The closest thing I found was 7699c44 by @andy-goryachev-oracle but it is also included in v23 and v24. This behavior I'm observing is present only in v25
>> 
>> Edit: forgot to mention that by doing `bottom.setMinHeight(Region.USE_PREF_SIZE);` the old behavior is back and the text is wrapped.
>
>> @palexdev That's correct, it's probably related to the regression you can find in the ticket linked to this PR: https://bugs.openjdk.org/browse/JDK-8377153
>> 
>> Once this fix is in, this won't be needed.
> 
> @hjohn Thanks a lot for the clarification! From my understanding this specific PR will fix the FlowPane layout algorithm, but not my case (VBox), so I presume you will follow up with a separate PR, did I get it right?

> @palexdev Sorry, I totally misread your question, I thought this was about `FlowPane`.
> 
> There are no problems in `VBox` that I'm aware of. Could you create a small test program to show me the exact issue, and I will take a look at where the problem is?

@hjohn Actually, our layout is much more complex, because the tiles we have are ultimately wrapped in FlowPanes.
I built JavaFX locally including this change and it actually fixed the issue. So, I can confirm that what we are experiencing is the same regression.
Will this fix be backported to v25?

-------------

PR Comment: https://git.openjdk.org/jfx/pull/2077#issuecomment-3957691960


More information about the openjfx-dev mailing list