WordPress / gutenberg

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

Border allows custom color picker even when custom color is set to false in theme.json #59567

Open andreawetzel opened 7 months ago

andreawetzel commented 7 months ago

Description

In theme.json having a custom color setting as false still allows the color picker for border color. The goal is to allow theme users to be able to choose from the color palette for border colors, but not have access to the color picker to choose any of the custom Hex, RGB, HSL color options

Step-by-step reproduction instructions

In theme.json, set custom color setting to false and note that the custom color option is still available in core/group block under styles > border.

  "settings": {
    "color": {
      "custom": false,

Note that I can set border color to false in theme.json settings overall or for each block, but this also removes the ability to choose from my theme's color palette as well as removing the custom color picker.

  "settings": {
    "border": {
      "radius": true,
      "color": false,
      "style": false,
      "width": false
    },

Screenshots, screen recording, code snippet

In the screenshot below, the limited color palette is shown but custom color picker is also shown for border color

Screenshot 2024-03-04 at 10 29 43 AM

Environment info

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

annezazu commented 7 months ago

Thank you for opening this! Added a few more labels.

Tested in WP 6.4.3 and 6.5-beta3 (no Gutenberg plugin)

Because this is present in both 6.4.3 and 6.5 beta 3, I'm afraid this isn't a bug isolated to just the beta period of 6.5. We enter RC1 tomorrow where we focus on fixing bugs found during the beta period/related to the beta period. As a result, I'm not going to add this to the 6.5 board.

cbravobernal commented 7 months ago

If you don't mind, I'd like to work on this feature for the March 24th Contributor table at WordCamp Torrelodones 2024.

vraja-pro commented 6 months ago

The problem is with the redux store "core/block-editor" In the post editor is it not loaded and in the site editor it is loaded but without state. For site editor - we need to import register from @wordpress/data to packages/block-editor/src/store/index.js and add in line 38:

register( store );
vraja-pro commented 6 months ago

Back on this issue in Yoast contributor day, the register is done in a different file, so that was not the issue.