RFR: 8354795: DialogPane show details button wipes out base style class "hyperlink"

Andy Goryachev angorya at openjdk.org
Thu Apr 17 16:02:12 UTC 2025


On Wed, 16 Apr 2025 08:51:36 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:

> The "show details" hyperlink button in an alert dialog that has an expandable detail area wipes out its base style class by overwriting all styles. This means styling in modena.css that targets `.hyperlink` is no longer applied, like the default text fill colors.
> 
> The culprit is this code in DialogPane:
> 
>         InvalidationListener expandedListener = o -> {
>             final boolean isExpanded = isExpanded();
>             detailsButton.setText(isExpanded ? lessText : moreText);
>             detailsButton.getStyleClass().setAll("details-button", (isExpanded ? "less" : "more")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
>         };
> 
> Here it uses `setAll` to set styles, wiping out the default `.hyperlink` style from "Hyperlink detailsButton = new HyperLink()"

I've added the Dialog page to the monkey tester
https://github.com/andy-goryachev-oracle/MonkeyTest

Looking at the stock behavior, I don't really see the problem.  The .details-button should not _look_ a hyperlink (despite being implemented using Hyperlink control), so the code seems to be correct in that it replaces the hyperlink style with something else.

What we probably need for the dark mode is to update the stylesheet as you described in the ticket.

What do you think?

![Screenshot 2025-04-17 at 08 59 10](https://github.com/user-attachments/assets/d9536f3b-d1bc-4f4f-8803-d003f2bd411c)

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

PR Comment: https://git.openjdk.org/jfx/pull/1779#issuecomment-2813427379
PR Comment: https://git.openjdk.org/jfx/pull/1779#issuecomment-2813429506


More information about the openjfx-dev mailing list