"suggested-action" CSS class on a GTK4 MenuButton

I’m migrating a Python GTK3 application to GTK4 and I’m confused with the new MenuButton. With GTK3, adding the “suggested-action” CSS class on a MenuButton would make it blue, but this does not work with GTK4: the MenuButton keeps its default background color.

Applying the “suggested-action” CSS class on a GTK4 Button works as expected.

I’ve done some tests with the GTK Inspector, and applying the “suggested-action” CSS class to the ToggleButton inside the MenuButton changes the MenuButton background color to blue.

Is it possible for a GTK4 MenuButton to act like a GTK3 MenuButton regarding the “suggested-action” CSS class? Should I apply the “suggested-action” CSS class directly to the ToggleButton?

Thanks.

The libadwaita stylesheet supports suggested-actions on GtkMenuButton.

Should I apply the “suggested-action” CSS class directly to the ToggleButton?

I would advice against it, that takes advantage of implementation details of GtkMenuButton that might or might not be changed tomorrow.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.