Hi Themeco,
Pro 5.0.8, WP 5.8 clean local install.
Using dynamic content in color pickers and unit picker controls seem a little hit and miss depending on the element.
On the Dropdown element for example, when dynamic content set in Global > Colors it appears to work for background, border, boxshadow colors. However, I set the same dynamic content value in the Dropdown controls it does not work.
The Toggles do seem to work.
I notice the Dropdown renders the following, the problem looks like its placing in the inline CSS variable styles in the markup id attribute instead of style.
<div id="--tco-dc1ew-2:hsla(var(--color-primary-h), var(--color-primary-s), var(--color-primary-l), 0.5);;--tco-dc1ew-3:hsla(var(--color-black-h), var(--color-black-s), var(--color-black-l), 0.5);;" class="x-dropdown m1ew-11 m1ew-13 m1ew-15 e1832-16 x-active" data-x-stem="dr" data-x-stem-root="" data-x-toggleable="e1832-16" aria-hidden="false" style="inset: 61.25px auto auto 1238.22px;"><div class="x-div e1832-17 m1ew-3 m1ew-5 m1ew-6 m1ew-7"><div class="x-text x-text-headline e1832-18 m1ew-16 m1ew-17 m1ew-1a"><div class="x-text-content"><div class="x-text-content-text"><h6 class="x-text-content-text-primary">Featured</h6></div></div></div><div class="x-div e1832-19 m1ew-3 m1ew-4 m1ew-5 m1ew-8"><a class="x-anchor x-anchor-button has-graphic e1832-20 m1ew-c m1ew-f m1ew-j m1ew-k m1ew-m m1ew-n m1ew-p m1ew-q m1ew-r m1ew-s m1ew-z m1ew-1" tabindex="0" href="#">
This may well be happening for other elements to. The Toggle renders the following which seems to work.
<a class="x-anchor x-anchor-toggle has-particle e1832-7 m1ew-c m1ew-d m1ew-e m1ew-f m1ew-g m1ew-h m1ew-i m1ew-j" tabindex="0" style="--tco-dc1ew-0:hsla(var(--color-black-h), var(--color-black-s), var(--color-black-l), 0.15);;--tco-dc1ew-1:hsla(var(--color-black-h), var(--color-black-s), var(--color-black-l), 0.15);;" data-x-toggle="1" data-x-toggleable="e1832-7" data-x-toggle-hover="1" aria-controls="e1832-7-dropdown" aria-expanded="false" aria-haspopup="true" aria-label="Toggle Dropdown Content"><div class="x-anchor-content"><div class="x-anchor-text"><span class="x-anchor-text-primary">The-Text-Toggle</span></div></div></a>
I also wanted to ask. what the expected return format of Dynamic Content when used in element controls? As you notice, I return HLSA split by hue, saturation, lightness which are pre-define css variables in my stylesheet, with alpha
hsla(var(--color-h), var(--color-s), var(--color-l), 0.5);
When using this approach Dynamic Content approach the element builder controls it generates and duplicate an inline variable for each of the H, S and L color components with the same properties.
EDIT UPDATE1 I am not sure if it duplciates or not. For example on a the Dropdown > Toggle, I only set the Primary Text color to use Dynamic Content and nothing else. This does create two identical inline CSS variables. I also believe an inline CSS variable is created for where ever Dynamic Content used in a element. So if I set background, border, boxshadow and text-color for example this would create 4 inline CSS variables on top of duplicated text-color. I am sure this is something you’re looking at for the next update, if the same Dynamic Content value is used for background, border, boxshadow and text-color to deduplicate and only create one inline CSS variable.
… All said however just being able to use Dynamic Content in the pickers is AWESOME
EDIT UPDATE2, the same issue occurs using Dynamic Content in the element controls with the Off Canvas and Modal elements - as with Dropdown, the inline CSS variable styles are in the markup id attribute instead of style.
Also another strange behaviour, when using Dynamic Content in Global > Colors the colors do not apply in Preview. Where as for the elements where Dynamic Content works within the element controls, like the Headline, the colors do apply in Preview when used in the control but do not Preview when using Global > Colors.