Skip to content

docs: fix incomplete tab panel snippet in cookbook#13

Merged
psd-coder merged 1 commit into
mainfrom
fix-cookbook-example
Jun 27, 2026
Merged

docs: fix incomplete tab panel snippet in cookbook#13
psd-coder merged 1 commit into
mainfrom
fix-cookbook-example

Conversation

@psd-coder

Copy link
Copy Markdown
Owner

Overview

Fixes a broken TypeScript snippet in the "Child needs parent state or API" cookbook section of the docs.

Problem Statement

The cookbook example for context-driven parent-child communication had a truncated line (ctx.host.setAttribute('aria-)), reported in #12. A reader copying the snippet would hit a syntax error. The same snippet also declared a register field on TabsAPI that was never provided, so it wouldn't type-check.

Solution Approach

  • Completed the truncated effect so the panel toggles its own visibility from the context $active value (ctx.host.hidden = active !== ctx.props.$value.get()), matching the canonical working tabs.html example.
  • Removed the unused register field from TabsAPI so the parent's provide() call and the type agree.

Closes #12

Complete the truncated effect to toggle panel visibility via context
$active, matching the working tabs example. Drop unused register field
from TabsAPI so the snippet type-checks. Closes #12
@psd-coder psd-coder merged commit b2d5245 into main Jun 27, 2026
8 checks passed
@psd-coder psd-coder deleted the fix-cookbook-example branch June 27, 2026 23:04
@github-actions

Copy link
Copy Markdown

size-limit report 📦

Path Size
.size-check/index.mjs 2.36 KB (0%)
.size-check/render.mjs 417 B (0%)
.size-check/context.mjs 402 B (0%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cookbook example for "Child needs parent state or API" has incomplete line of code

1 participant