On Mon, 17 Aug 2026 09:24:01 GMT, Ambarish Rapte <[email protected]> wrote:
>> eduardsdv has updated the pull request incrementally with one additional
>> commit since the last revision:
>>
>> 8389970: Add additional mnemonic tests
>
> modules/javafx.controls/src/main/java/javafx/scene/control/skin/LabeledSkinBase.java
> line 560:
>
>> 558: text.setText("");
>> 559: } else {
>> 560: textWidth =
>> snapSizeX(Math.min(text.getLayoutBounds().getWidth(), wrapWidth));
>
> `ignoreText` would be true in two cases, either
> - when the text is empty / null or
> - `ContentDisplay.GRAPHIC_ONLY` is true. refer [
> LabeledSkinBase.isIgnoreText()](https://github.com/openjdk/jfx/blob/3b54913c53f5ac079278a934081d87ce7d55173f/modules/javafx.controls/src/main/java/javafx/scene/control/skin/LabeledSkinBase.java#L1241)
>
> With this change, `updateDisplayedText()` gets invoked unconditionally even
> for the scenario when the text is non-empty, but needs to be ignored because
> `ContentDisplay.GRAPHIC_ONLY` is true.
>
> Please check if this can cause any issue.
You are right.
This is my approach to fix the issue by calling the ``updateDisplayedText()``
regardless of the value of ``ignoreText``. Otherwise, the ``containsMnemonic``
value may be stale.
I added additional tests to check combinations ``ContentDisplay.GRAPHIC_ONLY``
and ``ContentDisplay.TEXT_ONLY`` with empty and null text.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/2253#discussion_r3796423658