Skip to content

Fix custom color palette conflict with block themes (e.g. Blocksy)#975

Open
ravinderk wants to merge 5 commits into
release/M26.haunterfrom
fix/KAD-5436-block-custom-color-blocky-them-conflict
Open

Fix custom color palette conflict with block themes (e.g. Blocksy)#975
ravinderk wants to merge 5 commits into
release/M26.haunterfrom
fix/KAD-5436-block-custom-color-blocky-them-conflict

Conversation

@ravinderk
Copy link
Copy Markdown
Contributor

@ravinderk ravinderk commented Apr 27, 2026

Resolve: KAD-5436

Description

Fixes a conflict where custom block themes color palettes override by our plugin such as Blocksy. Ensures the correct color palettes are applied to color picker in the editor and on the frontend.

Changes

  • Sync updated palette colors to both the legacy colors setting and __experimentalFeatures.color.palette.theme on color state change in color-palette-defaults.js
  • Remove duplicate updateSettings({ colors }) call from saveConfig (now handled reactively)
  • Display theme color palette in Kadence color palette.

Prevent custom color settings from being overwritten by block theme.

Jira: KAD-5436
- Add inline style in advancedheading to ensure kb-palette colors
  take precedence over root CSS variables set by themes like Blocksy
- Sync colors to both legacy colors setting and __experimentalFeatures
  on color state change in color palette defaults

Jira: KAD-5436
@ravinderk ravinderk self-assigned this Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 27, 2026

🎉 Zip build complete

Build timestamp

@ravinderk ravinderk changed the base branch from release/M26.gardevoir to release/M26.haunter April 27, 2026 18:22
@ravinderk ravinderk force-pushed the fix/KAD-5436-block-custom-color-blocky-them-conflict branch from 3d02777 to 97412ae Compare April 27, 2026 18:26
console.error('Failed to update colors', error);
}
}
}, [colors, existingFeatures, updateSettings]);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure existingFeatures and updateSettings should be included in the dependency array as it could lead to an infinite loop. I think they should probably be removed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I kept only colors as dependency

existingFeatures.color.palette.theme = colors;
updateSettings({
colors, // Legacy support for color palette, will be removed in future versions.
__experimentalFeatures: existingFeatures, // Update the experimental features with the new color palette.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

existingFeatures is a live reference to the Redux store's state object, obtained via useSelect. Mutating it directly is a React/Redux anti-pattern and undefined behavior. The store may or may not reflect the change depending on whether it does shallow or deep comparisons, and it bypasses immutability guarantees.

Maybe this instead:
updateSettings({
colors,
__experimentalFeatures: {
...existingFeatures,
color: {
...existingFeatures?.color,
palette: {
...existingFeatures?.color?.palette,
theme: colors,
},
},
},
});

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good suggestion. Fixed.

Keep the editor color palette update scoped to the theme palette\ninstead of replacing the full experimental features object.\n\nJira: KAD-5436
Copy link
Copy Markdown
Contributor

@gilbert-hernandez gilbert-hernandez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants