On Wed, 16 Apr 2025 08:51:36 GMT, John Hendrikx <jhendr...@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()" In Windows, and also our color chooser, hyperlinks are used with some regularity to avoid a button where it would look out of place -- in small windows, buttons often are seen as a "closing" action, which show details clearly is not intended to be. The Windows copy dialog for example has a show details text that's clickable, and when keyboard focused displays the classic hyperlink dashed rectangular border. I've looked in FX code, and wiping out the base style is AFAICS not done anywhere. There are of course many cases of `getStyleClass().setAll( ... )` but all of the ones I checked do this on non-Controls (StackPane most often). The big difference here is that such containers like StackPane don't have a default style so there is nothing that would be overwritten. Only controls have these, and wiping it out is, and I'm repeating myself, highly unusual as it will kill many lines of default styling in modena leaving you to have to repeat all those lines. That didn't happen, and neither was this code commented as "intentionally removing the default style class for this control". If this indeed was the intent, then it would have made **much** more sense to not wipe out the base style, and only make adjustments specifically for hyperlinks that are also styled with `.details-button`. ------------- PR Comment: https://git.openjdk.org/jfx/pull/1779#issuecomment-2813924443