Closed (won't fix)
Project:
Drupal CMS development repository
Component:
Olivero
Priority:
Normal
Category:
Task
Assigned:
Issue tags:
Reporter:
Created:
27 Mar 2025 at 14:33 UTC
Updated:
1 Jul 2025 at 17:04 UTC
Jump to comment: Most recent, Most recent file

Comments
Comment #2
javi-er commentedComment #3
pdureau commentedCurrently with Javier. I will review this before any merge.
Comment #4
caligan commentedI've started roughing this out using card-grid and accordion as a pattern.
Edit: Sorry, I see this is in progress and will hold.
Comment #6
javi-er commentedThis is ready for review now, in order to test it you can do the following:
1- copy core/themes/olivero/templates/layout/page.html.twig to wthemes/contrib/drupal_cms_olivero/templates/layout
2- embed the component on page.html.twig:
See attached screenshot, make sure to test with three, two and one statistic.
Comment #7
pdureau commentedi take it
Comment #8
mherchelI gave a quick look at the markup and CSS and added a couple suggestions. Everything is looking great at first glance although I haven't yet tested it (will probably do so next week).
Thanks for working on this!
I'm also crediting @caligan here, since she worked on it at the DrupalCon Atlanta sprints (although it looks like work was duplicated with @javi-er, which happens).
Comment #9
phenaproximaComment #10
caligan commentedI ran across discussion of the use of 'eyebrow' in the cards component, suggesting 'title' or 'pretitle' instead: https://www.drupal.org/project/drupal_cms/issues/3497385#comment-15934581
Comment #11
javi-er commented@caligan sorry about that, someone pointed me to this ticket and since it wasn't assigned to anybody I worked on it.
Comment #12
javi-er commented@mherchel I adjusted the details from your feedback, thanks! let me know if you notice anything else.
Regarding the 'aria-labelledby' attribute, I added it to the section, but since headings for sections and articles are required, it shouldn't be necessary to have it, I've done some tests with 'article' elements and headings without it and they are described correctly by accessibility tools (unless it's nested under several elements or inside an anchor element), however it doesn't hurt to include it.
The term 'pretitle' seems appropriate as well for describing the short text above the statistic, naming things is hard. However I remember having this same discussion internally and 'eyebrow' is an old term, widely used in print media for describing these elements too. Let me know what do you prefer and I'll be happy to change it.
By the way, @caligan feel free to push changes to this MR if you feel too, I don't mind working on this collaboratively.
Comment #13
caligan commented@javi-er - Not a problem at all, I hadn't convinced myself I was up to it yet and should've commented sooner. Looking good!
Regarding names, though, maybe 'percentage' should be 'value'? Since it's not always a percentage, it implies a constraint that doesn't exist, and could give the incorrect impression it'll append % automatically.
Comment #14
kwiseman commentedAdded parent issue
Comment #15
javi-er commented@caligan yes I agree, "value" makes much more sense, updated.
Comment #16
pdureau commentedHi Javier,
It would have been better to use https://www.drupal.org/project/sdc_devel because it would have caught half of my feedbacks.
statistics-groupcomponent: Twig templateThe
attributesvariable is not used. A default attributes object is always injected in template and expected by many Drupal API (for example: adding a10n attributes, i18n attributes, compatibility with|set_attribute()and|add_class()filters...)It will also allow you do manage
aria-labelledbyoutside the HTML element markup (so in a more readable way, IMHO):Avoid
clean_unique_idbecause this function call the application state through Html::getUniqueId(). A component must stay stateless. So, instead of:You can do something like that:
statistics-groupcomponent: YAML definitionThere is a reference to a definition provided by Experience Builder module, so this may break if the module (which is still in an early phase) is not activated:
It is better to directly write the expected schema:
cta_urlmust be an URL instead of a just string. Proposal:descriptionmay be better as a slot, to be able to inject any renderable in the DIV:(It is not mandatory to use Twig blocks for slots, so you can keep the template like that)
statistics-itemcomponent: Twig templateSame feedback for the
attributesvariable.statistics-itemcomponent: YAML definitionSame feedback for
$ref: json-schema-definitions://experience_builder.module/textarea. Moreover, as shared with XB team last week, this reference has the name of a form widget instead of a data structure.Same feedback for
descriptionwhich may be better as a slot.Other
drupal_cms_oliverocomponentsBecause the development is happening outside of Drupal Core, those Olivero component went a bit under the radar and could be fixed and improved:
$refsto XBcontentin Paragraph)componentMetadata.pathinstead of the newicon()function.sourcevariabletitle_attributes,label,content_attributesandcontentvariablesinclude()function instead of the expectedsource()Twig function (or, better, theicon()function from the new Icon API)I will create a dedicated ticket for them.
Comment #17
javi-er commentedThanks for the feedback @pdureau ! yes, you mentioned
sdc_develto me but I completely forgot about it when I got to work on the component, instead I used as example the upcoming accordion component, which it's also facing similar issues now that I look at it (#3508546). I rushed it up to have it done before the contribution sprint ended, but I can iterate on this as many times as necessary until it's good.When I try to see the
sdc_develreport I'm getting this error, searching the issue queue I found this one that's similar and should be fixed, I'll post an issue on the module later regarding this.LogicException: Attribute "value" does not exist for Node "Twig\Node\Expression\Binary\ConcatBinary". in Twig\Node\Node->getAttribute() (line 158 of /var/www/html/vendor/twig/twig/src/Node/Node.php).It makes sense to use the
attributesvariable, I was wondering about this when implementing it, also I like that the objective is to keep components free of Drupal specific functions, it should make them more compatible with external systems.It actually breaks if the module is not enabled, I had to enable it in order for my component to render. Looking at the other existing components, most of them use these XB specific schemas, if the objective is for these components not to require XB, it should be fixed in almost all the other components under
drupal_cms_olivero/componentsas well. I changed this one to use the regex you suggest.Agree, it's very likely that this text comes from CKE in the future, I changed it. I switched t a block for consistency, but I can use a variable instead if prefered.
Let me know if you have more feedback, this also needs a CSS review and a functional review. I tested with every combination I could try to make sure that it works well under most use cases.
Comment #18
javi-er commentedComment #19
pdureau commentedI am totally aware of that. In a perfect world, it would be better to not have such Attribute PHP object in our template, because all PHP objects must be avoided in template, and because it is better to stick as much as possible with vanilla Twig. But we don't have a replacement for this yet.
Today, among all the stuff added by Drupal to Twig, I see only 5 additions we can use in component templates:
PrintNodevisitor to send all printed variable to the renderer service. That's the core of Drupal Twig rendering and must be kept.Attributeobject and the relatedcreate_attribute()function, but I hope this issue will allow us to get rid of it one of those days: #3457874: HTML attributes as Twig mappings instead of PHP objectsadd_class()&set_attribute()filters, they make sense with the SDC slots and they follow Twig philosophy of altering existing data.icon()function for the Icon API. It follows Twig philosophy of using function to generate printable datatfunction,transtag). Important feature for a CMS. Why not proposing this to upstream Twig?Everything else (
clean_id(),attach_library(),link(),|add_suggestion()...) is avoidable.I prefer to simply print my slots, but blocks are OK too. It is a matter of personal taste (except a few situations where blocks may be problematic).
I will have a look this week.
Comment #20
bernardm28 commentedI agree with most of Pier's additions, but one thing. clean_unique_id provides a more semantic version than random(), and it's a better experience for the end user.
I would argue that even if it violates the component state, there's no better alternative. What would be a downside of having it in practice? Would it not get cached as good, or is it more of the principle behind it?
Comment #21
bernardm28 commentedAlso, thanks for dropping so many insights.
Comment #22
javi-er commented@bernardm28 I like clean_unique_id as well since it adds an incremental value if necessary instead of a random number, but in terms of experience for the actual user it doesn't change anything since screen readers don't actually announce the id value, neither is visible in any way in the browser, maybe in the URL if you link to it.
Comment #23
pameeela commentedI'm really, really sorry to do this, but given that we are shifting to site templates in 2.0, we don't plan to add new features to the 1.x branch and Olivero in particular. Everyone who worked on this should still get credit for their contributions, which we really appreciate!