WordPress / gutenberg

The Block Editor project for WordPress and beyond. Plugin is available from the official repository.
https://wordpress.org/gutenberg/
Other
10.49k stars 4.19k forks source link

Button Block: ability to disable Border Radius and Width controls #19796

Open dougwollison opened 4 years ago

dougwollison commented 4 years ago

Is your feature request related to a problem? Please describe. Most themes I build have a strict set of button styles, which includes a limited set of border radius options. Currently, while I can override the border radius on buttons, I can't remove the block editor panel offering the border radius slider. This can result in a confusing interface for the user who sees the slider, tries playing with it, only to find it does nothing. Same goes for the Width settings panel (alternatively, I may want other width options besides 25% increments).

Other panels like the Text Settings one (up until #19208 that is) I can at least display:none in order to hide the Drop Cap option (which still can't be disabled).

Describe the solution you'd like The ability to, either via add_them_support() in PHP or some javascript API like unregisterBlockStyle, disable the border radius panel on buttons (or otherwise everywhere). The button block should be modified so that the Border Radius and Width panels are conditional based on block support, similar to the paragraph block's typography and color settings, which can be fully disabled via supporst/block_editor_settins.

Describe alternatives you've considered Another solution would be to add a classname to the panels so it can be hidden via the admin stylesheet.

paaljoachim commented 2 years ago

Is this issue still valid or can we close it?

skorasaurus commented 2 years ago

@paaljoachim It is still valid: the border radius can be disabled; but the width controls cannot be disabled as of yet.

(Note: do not close even after https://github.com/WordPress/gutenberg/pull/42079 ; that issue is for the border width; this issue here requests the width of the entire button block).

QuietNoise commented 2 months ago

To hide width settings in CMS I just do this:

.components-button-group[aria-label="Button width"] {
  display: none;
}

🤣 Not perfect but I deal with english version only so far.

I still can't believe this issue is not yet addressed. Is there a way to tackle this with wp.hooks filters to remove these settings altogether?