Skip to content

Commit 20d4e6f

Browse files
committed
Playground sub-headings: h2 → h3 to nest under the section h2
The playground section uses h2 "Run the complete example", and each runner-panel inside it previously used h2 for "Example code" and "Expected output" — three peers at the same heading level where the document structure is actually nested: h2 Run the complete example ├── h2 Example code ← should be h3 └── h2 Expected output ← should be h3 Screen-readers and outline algorithms now read the nesting correctly. No visible change — .runner-panel h3 inherits the same 1.05rem / -0.02em / hairline underline styling that .runner-panel h2 had. Three files touched together so the template, prototype mirror, CSS rule, and assertion all match: src/templates/example.html h2 → h3 for Example code and OUTPUT_HEADING scripts/build_prototypes.py same change in the prototype mirror public/site.css .runner-panel h2 → .runner-panel h3 tests/test_app.py assertion updated to .runner-panel h3
1 parent 664205d commit 20d4e6f

6 files changed

Lines changed: 9 additions & 9 deletions

File tree

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
.runner-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(18rem, .75fr); gap: var(--space-4); align-items: stretch; }
109109
@media (max-width: 980px) { .runner-grid { grid-template-columns: 1fr; } }
110110
.runner-panel { min-height: 18rem; display: flex; flex-direction: column; border: 1px dashed var(--hairline); border-radius: .75rem; padding: var(--space-3); background: var(--surface); }
111-
.runner-panel h2 { margin: 0 0 var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--hairline-soft); font-size: 1.05rem; letter-spacing: -0.02em; }
111+
.runner-panel h3 { margin: 0 0 var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--hairline-soft); font-size: 1.05rem; letter-spacing: -0.02em; }
112112
.runner-panel pre { flex: 1; min-height: 0; overflow: visible; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
113113
.runner-editor { border-style: solid; background: var(--surface-2); cursor: text; transition: box-shadow 160ms cubic-bezier(0.2, 0, 0, 1); }
114114
.runner-editor:focus-within { box-shadow: 0 0 0 3px rgba(255, 72, 1, 0.12); }

public/site.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
.runner-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(18rem, .75fr); gap: var(--space-4); align-items: stretch; }
109109
@media (max-width: 980px) { .runner-grid { grid-template-columns: 1fr; } }
110110
.runner-panel { min-height: 18rem; display: flex; flex-direction: column; border: 1px dashed var(--hairline); border-radius: .75rem; padding: var(--space-3); background: var(--surface); }
111-
.runner-panel h2 { margin: 0 0 var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--hairline-soft); font-size: 1.05rem; letter-spacing: -0.02em; }
111+
.runner-panel h3 { margin: 0 0 var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--hairline-soft); font-size: 1.05rem; letter-spacing: -0.02em; }
112112
.runner-panel pre { flex: 1; min-height: 0; overflow: visible; white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
113113
.runner-editor { border-style: solid; background: var(--surface-2); cursor: text; transition: box-shadow 160ms cubic-bezier(0.2, 0, 0, 1); }
114114
.runner-editor:focus-within { box-shadow: 0 0 0 3px rgba(255, 72, 1, 0.12); }

scripts/build_prototypes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ def render_article(example: dict, *, banners: dict[str, str] | None = None) -> s
115115
<h2>Run the complete example</h2>
116116
<div class="runner-grid">
117117
<div class="runner-panel runner-editor">
118-
<h2>Example code</h2>
118+
<h3>Example code</h3>
119119
<pre><code class="language-python">{code}</code></pre>
120120
</div>
121-
<section class="runner-panel output-panel"><h2>Expected output</h2><pre><code>{output}</code></pre></section>
121+
<section class="runner-panel output-panel"><h3>Expected output</h3><pre><code>{output}</code></pre></section>
122122
</div>
123123
</section>
124124
</article>

src/asset_manifest.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Generated by scripts/fingerprint_assets.py. Do not edit by hand.
2-
ASSET_PATHS = {'SITE_CSS': '/site.ad38e31469d2.css', 'SYNTAX_JS': '/syntax-highlight.3b6c7f730d46.js', 'EDITOR_JS': '/editor.dd81f5171b14.js'}
3-
HTML_CACHE_VERSION = '01251bd4beba'
2+
ASSET_PATHS = {'SITE_CSS': '/site.9ad0aa5c4ab6.css', 'SYNTAX_JS': '/syntax-highlight.3b6c7f730d46.js', 'EDITOR_JS': '/editor.dd81f5171b14.js'}
3+
HTML_CACHE_VERSION = 'eaa23cebb468'

src/templates/example.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@ <h1>__TITLE__</h1>
1414
<h2>Run the complete example</h2>
1515
<div class="runner-grid">
1616
<form class="runner-panel runner-editor" method="post" action="/examples/__SLUG__">
17-
<h2>Example code</h2>
17+
<h3>Example code</h3>
1818
<textarea name="code" id="code-editor" spellcheck="false" rows="__EDITOR_ROWS__">__EDITABLE_CODE__</textarea>
1919
<div class="playground-toolbar">
2020
<button class="button" type="submit">Run</button>
2121
<button class="tool-button" type="button" data-reset onclick="resetCode()">Reset</button>
2222
</div>
2323
</form>
24-
<section class="runner-panel output-panel" aria-live="polite"__OUTPUT_PLACEHOLDER__><h2>__OUTPUT_HEADING__</h2><pre><code>__SHOWN_OUTPUT__</code></pre><p class="execution-time">__EXECUTION_TIME__</p></section>
24+
<section class="runner-panel output-panel" aria-live="polite"__OUTPUT_PLACEHOLDER__><h3>__OUTPUT_HEADING__</h3><pre><code>__SHOWN_OUTPUT__</code></pre><p class="execution-time">__EXECUTION_TIME__</p></section>
2525
</div>
2626
</section>
2727
</article>

tests/test_app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ def test_cf_workers_design_system_and_playground_lessons(self):
321321
self.assertNotIn('data-share', html)
322322
self.assertIn('output-panel', html)
323323
self.assertIn(".runner-panel", css)
324-
self.assertIn(".runner-panel h2", css)
324+
self.assertIn(".runner-panel h3", css)
325325
self.assertIn("text-underline-offset", css)
326326
self.assertIn('aria-live="polite"', html)
327327
self.assertIn('min-height: 18rem', css)

0 commit comments

Comments
 (0)