Feedbacks about SDC components

Created on 27 January 2025, 3 months ago

As a follow-up of Welcome message and some feedbacks about JSON schema Closed: works as designed , here are some feedbacks done with https://www.drupal.org/project/sdc_devel which is providing a drush command and a report page to audit SDC components.

Unused variables:

Every slot or prop from the component definition must be used in templates.

Default attributes object is not always defined in the YAML, but always injected in template and expected for alteration (adding contextual accessibility attributes, adding data for site building tools, style overrides of the component...).

$ vendor/bin/drush sdcv --install dsfr4drupal | grep  "Unused variables:"
 [notice] Start validation of dsfr4drupal...
footer-partners   Unused variables: attributes
footer-top-menu   Unused variables: attributes
transcription     Unused variables: modal_content
display-modal     Unused variables: attributes, modal_content
display-header    Unused variables: attributes
consent-modal     Unused variables: attributes, modal_content, required, services
button-group      Unused variables: alignment
range             Unused variables: input_title
toggle            Unused variables: input_title
tooltip           Unused variables: attributes
segmented         Unused variables: input_title
stepper           Unused variables: attributes       

Unknown variables

Every slot or prop used in the template must be found in the component definition (except the ones automatically injected: attributes, componentMetadata...)

$ vendor/bin/drush sdcv --install dsfr4drupal | grep  "Unknown variable:"
 [notice] Start validation of dsfr4drupal...
content     Unknown variable: `ratio`.     22     <div class="fr-responsive-vid{{ ratio == '4x3' ? ' fr-responsive-vid--4x3' }}">
pagination  Unknown variable: `current`.   46     {% if current == key %}
pagination  Unknown variable: `current`.   50     {% elseif key - current > 1 or key - current < -1 %}
pagination  Unknown variable: `current`.   50     {% elseif key - current > 1 or key - current < -1 %}
toggle      Unknown variable: `checked`.   28     {% if checked %} checked="checked" {% endif %}
tooltip     Unknown variable: `title_id`.  3      {% set tooltip_id = title_id|default('tooltip-' ~ random()) %}
tooltip     Unknown variable: `title_id`.  3      {% set tooltip_id = title_id|default('tooltip-' ~ random()) %}
tabs        Unknown variable: `label`.     3      <ul class="fr-tabs__list" role="tablist"{{ label ? ' aria-label="' ~ label ~ '"' : '' }}>
tabs        Unknown variable: `label`.     3      <ul class="fr-tabs__list" role="tablist"{{ label ? ' aria-label="' ~ label ~ '"' : '' }}>
segmented   Unknown variable: `legend`.    16     {{ legend }}
summary     Unknown variable: `title`.     6      <{{ title_tag }} class="fr-summary__title" id="{{ title_id }}">{{ title }}</{{ title_tag }}> 

Incomplete prop definitions

Array of empty object

This is not enough to be understood and processed by display builders ( UI Patterns 2 , the upcoming Experience Builder...):

      type: array
      items:
        type: object

Can we add a bit more details?

$ vendor/bin/drush sdcv --install dsfr4drupal  | grep "Array of empty object."
 [notice] Start validation of dsfr4drupal...
  footer-partners   Array of empty object.7      items:                                                                                         
  footer-top-menu   Array of empty object.7      items:                                                                                         
  sidemenu          Array of empty object.17     items:                                                                                         
  button-group      Array of empty object.32     items:                                                                                         
  navigation        Array of empty object.42     items:                                                                                         
  accordion-group   Array of empty object.14     items:                                                                                         
  link-group        Array of empty object.10     items:                                                                                         
  share             Array of empty object.18     items:                                                                                         
  badge-group       Array of empty object.10     items:                                                                                         
  breadcrumb        Array of empty object.17     items:                                                                                         
  footer-menu       Array of empty object.13     items:                                                                                         
  follow            Array of empty object.16     newsletter_items:                                                                              
  follow            Array of empty object.29     social_items:                                                                                  
  tabs              Array of empty object.10     panels:                                                                                        
  tabs              Array of empty object.16     tabs:                                                                                          
  tag-group         Array of empty object.10     items:                                                                                         
  consent-banner    Array of empty object.10     buttons:    

Same for empty objects:

$ vendor/bin/drush upv --install dsfr4drupal  | grep "Empty object."
 [notice] Start validation of dsfr4drupal...
  dsfr4drupal:pagination-mini   Empty object.   21     items:                                                                                         
  dsfr4drupal:pagination        Empty object.   28     items:   
📌 Task
Status

Active

Version

1.3

Component

Code

Created by

🇫🇷France pdureau Paris

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024