[Policy] SDC backwards compatibility policy

Created on 7 June 2023, over 1 year ago
Updated 18 June 2024, 5 months ago

Problem/Motivation

As discussed with @lauriii and @andy-blum at DrupalCon Pittsburgh.

The Stable 9 theme exists to provide a BC "fence" that provides CSS/Markup all-but-guaranteed to not change. This ensures a theme that declares Stable 9 as a base theme will not encounter unexpected regressions when core templates or CSS are changed. One of the primary reasons this "fence" is provided as an entire theme as opposed to something more as-needed is because markup and CSS are assets that are managed independently of each other yet are quite codependent once a page is rendered.

With Single Directory Components, this separate-but-dependent situation does not present the same concerns. Themes that wish to have a "stable" version of component can copy an SDC directory and have a frozen-in-amber version of the markup, CSS (and JS) that is relevant to it.

Because the components directories contain the precise assets needed, we propose not including Single Directory Components in Stable themes, as copying the component to a theme will provide the same assurances as base-theming Stable 9.

This would also make it easier to offer core components that aren't pressured to be style neutral as themes can override the entire component without specificity or bleedthrough concerns.

To determine if this policy is feasible, it would be worth SDC-ifiying some core components that would benefit from better default styles. Media Library comes to mind. Adding these SDCs to core modules would require a policy exception as they would be using an experimental module. The implementation would require some kind of escape hatch in the event of SDC not making it beyond the experimental stage. Given the popularity of SDC, it not making it past experimental may also require escape hatches for the human(s) that 👎 it...

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

🌱 Plan
Status

Active

Version

11.0 🔥

Component
single-directory components 

Last updated 3 days ago

Created by

🇺🇸United States bnjmnm Ann Arbor, MI

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

Comments & Activities

  • Issue created by @bnjmnm
  • 🇺🇸United States andy-blum Ohio, USA
  • e0ipso Can Picafort

    LOL at this excerpt from the IS:

    Given the popularity of SDC, it not making it past experimental may also require escape hatches for the human(s) that 👎 it...

    The reasoning here makes sense for me. The other alternative I see (which I don't like) is to carve out exceptions for the BC assurances on SDCs inside the stable themes.

    I am not sure I follow why we need this part:

    To determine if this policy is feasible, it would be worth SDC-ifiying some core components that would benefit from better default styles. Media Library comes to mind.

    How does this relate to the policy feasibility?

  • 🇺🇸United States bnjmnm Ann Arbor, MI

    To determine if this policy is feasible, it would be worth SDC-ifiying some core components that would benefit from better default styles. Media Library comes to mind. How does this relate to the policy feasibility?

    Perhaps not the best wording. On paper the "no-BC-for-SDC" sounds good, but an MR that converts some core components to SDC might reveal additional considerations that we're not currently thinking about, and these conversions could included as part of the switch to non-experimental.

    I did think of a BC consideration that should probably be in the policy. As detailed in the IS I think it's reasonable to allow SDCs to change as needed without too much BC fuss. However, for Stable 9 extending themes should have some kind of BC protection for components that have been converted to SDC - at minimum preserving the markup but ideally able to leverage the same preprocessor too.

  • 🇨🇦Canada xmacinfo Canada

    Given the popularity of SDC, it not making it past experimental may also require escape hatches for the human(s) that 👎 it...

    Experimental modules are not in a popularity game. Those Experimental modules exist to either try them out and make sure the whole stack work as expected or to use them, provided the site maintainers agrees to some risks and that they are willing to deal with those risks, if any arise. SDC is an exception, as, once stable, it will not be a module.

    I am interested to know about the impacts of converting some Twig themes to SDC in Stable. Would that break existing themes using Stable 9 as a base theme? Or will SDC be transparent to any themes expanding upon Stable?

  • e0ipso Can Picafort

    @bnjmnm how do we move this forward? Should we write a document about BC expectations in SDCs inside of Drupal core? Where should that live? I propose a documentation page, child of the official SDC documentation https://www.drupal.org/docs/develop/theming-drupal/using-single-director... . Any other ideas?

  • 🇺🇸United States xjm
Production build 0.71.5 2024