Colors assigned as 'preset' colors do not render correctly in the editor: Are assigned both STYLE values and CLASSes. #26506
Labels
[Feature] Themes
Questions or issues with incorporating or styling blocks in a theme.
[Focus] Accessibility (a11y)
Changes that impact accessibility and need corresponding review (e.g. markup changes).
[Type] Bug
An existing feature does not function as intended
When a 'preset' color is selected as the background color for an element BOTH of these things happen in the editor:
While the user's preferences are set to "light mode" this renders fine; the color values are the same.
The 'dark mode' of a theme changes the preset values to support that dark mode and the value are no longer the same as defined by the theme for the editor's consumption. Thus, while the user's preferences are set to "dark mode" this does NOT render fine as there is a mismatch between what the expected "preset" color is as represented in the editor and what will actually render as defined by the theme.
What is rendered in the VIEW is correct, as only those elements that have a custom color that is NOT set to a 'predefined' color have the style attribute added.
To reproduce
Steps to reproduce the behavior:
block to a page and add some text.
block is correctly rendered as BLACK (and foreground text white).
block is still rendered as BLACK (however the foreground text is now also black).
tag is correctly rendered with a "white-ish" background (the FOREGROUND color of the theme while in dark mode).
Expected behavior
An element that has a BACKGROUND COLOR or TEXT COLOR applied that is NOT a 'custom color' but instead a color defined as a 'preset' color should NOT have the color values applied via a style attribute, but only by way of the 'preset' color classes. (This is the same color attribute assignment behavior found in the rendered view.)
Screenshots
<p>
block in editor view with 'Foreground' preset color applied as the background (light mode):The same block in view mode (light mode):
<p>
block in editor view with 'Foreground' preset color applied as the background (dark mode):The same block in view mode (dark mode):
Editor version (please complete the following information):
Desktop (please complete the following information):
Additional context
The text was updated successfully, but these errors were encountered: