From e9980d812f9798f42d6176057db498c669707003 Mon Sep 17 00:00:00 2001 From: Mark Dumay <61946753+markdumay@users.noreply.github.com> Date: Mon, 13 Jul 2026 07:58:22 +0200 Subject: [PATCH] fix(structures): suppress inherited defaults on shared layout members The global argument defaults leak into shared user-defined types once v6 applies nested member defaults, overriding downstream fallbacks that expect absence (v5 semantics). Suppressed via explicit nil defaults, with per-member rationale comments: heading.width and illustration.width (text-column default shrinks images and compounds with section widths), illustration.justify and links.outline plus links.order (downstream partials layer their own defaults, e.g. download buttons render outlined by design), and the styles member overrides width, orientation, and portrait (per-style values must fall back to card-group context). Verified against production markup for about, heading, hero, featured, and video-message pages plus a 59-page structural sweep. Co-Authored-By: Claude Fable 5 --- data/structures/_types.yml | 26 +++++++---- exampleSite/data/structures/_types.yml | 26 +++++++---- tests/golden/bookshop.json | 32 ++++---------- tests/golden/frontmatter.json | 9 ++-- tests/golden/inittypes.json | 2 - tests/golden/nesting.json | 61 +++++++++----------------- tests/golden/schema.json | 2 - 7 files changed, 68 insertions(+), 90 deletions(-) diff --git a/data/structures/_types.yml b/data/structures/_types.yml index 8ff5948..44ffedd 100644 --- a/data/structures/_types.yml +++ b/data/structures/_types.yml @@ -14,11 +14,15 @@ types: content: align: arrangement: - width: + # no inherited default: consuming partials supply their own width fallback + # (hero derives 8, section-title spans the full column) as in v5 + width: { default: } size: illustration: image: - justify: + # no inherited default: hero-image centers by default and only applies + # md justification when explicitly set, as in v5 + justify: { default: } caption: caption-url: icon: @@ -26,7 +30,9 @@ types: class: anchor: mode: - width: + # no inherited default: the global width default (8) is meant for text + # columns and shrinks images; partials fall back to a full column as in v5 + width: { default: } image-overlay: hook: instructions: @@ -70,8 +76,10 @@ types: download: icon: force: - order: - outline: + # no inherited defaults: downstream partials layer their own (download.yml + # sets outline/order; section context supplies order) as in v5 + order: { default: } + outline: { default: } messages: - title: icon: @@ -89,9 +97,11 @@ types: values: styles: - ratio: - orientation: - portrait: - width: + # no inherited defaults: per-style overrides fall back to the card-group + # context values (inline/style.html) as in v5 + orientation: { default: } + portrait: { default: } + width: { default: } video: provider: account: diff --git a/exampleSite/data/structures/_types.yml b/exampleSite/data/structures/_types.yml index 95d1cc9..bbd5af1 100644 --- a/exampleSite/data/structures/_types.yml +++ b/exampleSite/data/structures/_types.yml @@ -18,11 +18,15 @@ types: content: align: arrangement: - width: + # no inherited default: consuming partials supply their own width fallback + # (hero derives 8, section-title spans the full column) as in v5 + width: { default: } size: illustration: image: - justify: + # no inherited default: hero-image centers by default and only applies + # md justification when explicitly set, as in v5 + justify: { default: } caption: caption-url: icon: @@ -30,7 +34,9 @@ types: class: anchor: mode: - width: + # no inherited default: the global width default (8) is meant for text + # columns and shrinks images; partials fall back to a full column as in v5 + width: { default: } image-overlay: hook: instructions: @@ -74,8 +80,10 @@ types: download: icon: force: - order: - outline: + # no inherited defaults: downstream partials layer their own (download.yml + # sets outline/order; section context supplies order) as in v5 + order: { default: } + outline: { default: } messages: - title: icon: @@ -93,9 +101,11 @@ types: values: styles: - ratio: - orientation: - portrait: - width: + # no inherited defaults: per-style overrides fall back to the card-group + # context values (inline/style.html) as in v5 + orientation: { default: } + portrait: { default: } + width: { default: } video: provider: account: diff --git a/tests/golden/bookshop.json b/tests/golden/bookshop.json index 180a074..df784d0 100644 --- a/tests/golden/bookshop.json +++ b/tests/golden/bookshop.json @@ -21,8 +21,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "button", "link_type": "button", @@ -40,8 +39,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "button", "showMore": false, @@ -51,7 +49,6 @@ "heading.align", "heading.arrangement", "heading.size", - "heading.width", "link_type" ], "err": true, @@ -78,8 +75,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "button", "showMore": false, @@ -89,7 +85,6 @@ "heading.align", "heading.arrangement", "heading.size", - "heading.width", "link_type", "show_more", "width" @@ -113,8 +108,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "button", "link_type": "button", @@ -131,8 +125,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "link", "showMore": false, @@ -142,7 +135,6 @@ "heading.align", "heading.arrangement", "heading.size", - "heading.width", "show_more", "width" ], @@ -163,8 +155,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "link", "link_type": "link", @@ -184,8 +175,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "link", "showMore": true, @@ -195,7 +185,6 @@ "heading.align", "heading.arrangement", "heading.size", - "heading.width", "width" ], "err": false, @@ -214,8 +203,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "link", "link_type": "link", @@ -232,8 +220,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "linkType": "button", "showMore": false, @@ -243,7 +230,6 @@ "heading.align", "heading.arrangement", "heading.size", - "heading.width", "link_type", "show_more", "width" diff --git a/tests/golden/frontmatter.json b/tests/golden/frontmatter.json index adf7fac..434846c 100644 --- a/tests/golden/frontmatter.json +++ b/tests/golden/frontmatter.json @@ -6,15 +6,13 @@ "align": "center", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "locations": [] }, "defaulted": [ "heading.arrangement", - "heading.size", - "heading.width" + "heading.size" ], "err": false, "errmsg": [], @@ -28,8 +26,7 @@ "align": "center", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "locations": [], "warnmsg": [] diff --git a/tests/golden/inittypes.json b/tests/golden/inittypes.json index 7e97992..e6a77d1 100644 --- a/tests/golden/inittypes.json +++ b/tests/golden/inittypes.json @@ -119,7 +119,6 @@ }, "width": { "comment": "Column width of the element. For embedded elements, the width is relative to the parent's container.", - "default": 8, "optional": true, "options": { "max": 12, @@ -245,7 +244,6 @@ }, "width": { "comment": "Column width of the element. For embedded elements, the width is relative to the parent's container.", - "default": 8, "optional": true, "options": { "max": 12, diff --git a/tests/golden/nesting.json b/tests/golden/nesting.json index 6ca55c7..450309a 100644 --- a/tests/golden/nesting.json +++ b/tests/golden/nesting.json @@ -5,16 +5,14 @@ "heading": { "align": "start", "arrangement": "above", - "size": 4, - "width": 8 + "size": 4 }, "locations": [] }, "defaulted": [ "heading.align", "heading.arrangement", - "heading.size", - "heading.width" + "heading.size" ], "err": false, "errmsg": [], @@ -27,8 +25,7 @@ "heading": { "align": "start", "arrangement": "above", - "size": 4, - "width": 8 + "size": 4 }, "locations": [], "warnmsg": [] @@ -40,8 +37,7 @@ "heading": { "align": "start", "arrangement": "above", - "size": 4, - "width": 8 + "size": 4 }, "locations": [ { @@ -60,7 +56,6 @@ "heading.align", "heading.arrangement", "heading.size", - "heading.width", "locations[0].mode" ], "err": false, @@ -74,8 +69,7 @@ "heading": { "align": "start", "arrangement": "above", - "size": 4, - "width": 8 + "size": 4 }, "locations": [ { @@ -99,15 +93,13 @@ "align": "center", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "locations": [] }, "defaulted": [ "heading.arrangement", - "heading.size", - "heading.width" + "heading.size" ], "err": false, "errmsg": [], @@ -121,8 +113,7 @@ "align": "center", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "locations": [], "warnmsg": [] @@ -135,16 +126,14 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "locations": [] }, "defaulted": [ "heading.align", "heading.arrangement", - "heading.size", - "heading.width" + "heading.size" ], "err": false, "errmsg": [], @@ -158,8 +147,7 @@ "align": "start", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "locations": [], "warnmsg": [] @@ -173,16 +161,14 @@ "arrangement": "above", "size": 4, "title": "Hello", - "typo-key": "oops", - "width": 8 + "typo-key": "oops" }, "locations": [] }, "defaulted": [ "heading.align", "heading.arrangement", - "heading.size", - "heading.width" + "heading.size" ], "err": true, "errmsg": [ @@ -199,8 +185,7 @@ "arrangement": "above", "size": 4, "title": "Hello", - "typo-key": "oops", - "width": 8 + "typo-key": "oops" }, "locations": [], "warnmsg": [ @@ -215,15 +200,13 @@ "align": "42", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "locations": [] }, "defaulted": [ "heading.arrangement", - "heading.size", - "heading.width" + "heading.size" ], "err": true, "errmsg": [ @@ -239,8 +222,7 @@ "align": "42", "arrangement": "above", "size": 4, - "title": "Hello", - "width": 8 + "title": "Hello" }, "locations": [], "warnmsg": [ @@ -254,16 +236,14 @@ "heading": { "align": "start", "arrangement": "above", - "size": 4, - "width": 8 + "size": 4 }, "locations": [] }, "defaulted": [ "heading.align", "heading.arrangement", - "heading.size", - "heading.width" + "heading.size" ], "err": false, "errmsg": [], @@ -276,8 +256,7 @@ "heading": { "align": "start", "arrangement": "above", - "size": 4, - "width": 8 + "size": 4 }, "locations": [], "warnmsg": [] diff --git a/tests/golden/schema.json b/tests/golden/schema.json index e574631..2ce1d01 100644 --- a/tests/golden/schema.json +++ b/tests/golden/schema.json @@ -161,7 +161,6 @@ ], "camelKey": "width", "comment": "Column width of the element. For embedded elements, the width is relative to the parent's container.", - "default": 8, "kind": "scalar", "name": "width", "optional": true, @@ -488,7 +487,6 @@ ], "camelKey": "width", "comment": "Column width of the element. For embedded elements, the width is relative to the parent's container.", - "default": 8, "kind": "scalar", "name": "width", "optional": true,