Problem/Motivation

Given an empty content, some components still emit their markup, while others correctly return nothing.

header, footer, modal, share, display, consent_banner, consent_manager, france_connect and transcription are out of scope: they carry their own interface and are meant to render on their own.

But here are some components potentially concerned : summary, side_menu, link, button, tab, card, alert, notice, callout, content_media, tab_panel, stepper, tag..etc

We need also to write the markup when the part the DSFR declares mandatory is there.

Some thoughts :
- summary: a title and at least one link
- side_menu: at least one item. The title stays optional, as the doc says, and the landmark falls back to an aria-label when it is missing
- stepper: a title
- notice: a title, a description or a link. The body wrapper stops being conditional
- alert: a title or a message
- callout: a title or a text
- content_media: an image or a video
- card: any of its parts, which are all optional
- tag: a label
- tab: a title
- link and button: a label, or an icon. With an icon and no label, the title becomes the label, which is what the doc asks for the icon-only variant
- Inside summary and side_menu, a link with an empty title drops out instead of becoming an empty anchor.
- Layout containers keep their empty shell: grid_row, grid_row_1 and tab_panel are plain div elements.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

just_like_good_vibes created an issue. See original summary.

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » pdureau
Status: Active » Needs review
pdureau’s picture

Indeed, in any Web design system, some components are expected to not be rendered according to some conditions (missing slot(s), some prop(s) values...).

If the upstream documentation and examples don't tell what is expected, it is up to the implementation owner (the Drupal themer here), to decide when authoring the Twig.

Your proposal is updating 11 components. Each one must be check individually.

Some though before the review:

  • There are 2 kinds of added logic: the ones at prop level, as expected, but also the ones at link item level (summary, side_menu,
  • Let's be careful with alteration in button and tag where most logic revolve around url prop
  • There are also some linting alteration (notice)
pdureau’s picture

Assigned: pdureau » just_like_good_vibes
Status: Needs review » Reviewed & tested by the community

If we are sure button and tag logic are still OK, and if the changes has been checked against proper upstream documentation: RTBC

just_like_good_vibes’s picture

Assigned: just_like_good_vibes » Unassigned
Status: Reviewed & tested by the community » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.