Repository navigation
fix(Tabs): drop the Content value prop nothing read, and say when a child is ignored - #42
Merged
Merged
Conversation
… child is ignored `TabContentProps` declared a `value`, documented as associating a panel with a trigger "for Radix-style API — when the active tab value matches, this content is shown". Nothing read it. `TabContent` decides purely on `useTabItemContext().isSelected`, so a panel written in that shape — a sibling of the triggers rather than nested in its `Tabs.Item` — rendered nothing. It was silent as well as wrong. `Tabs` walks its direct children looking for a `TabTrigger` among each one's children and keeps the child only `if (trigger)`; a bare `Tabs.Content` has none, so it was discarded before `TabContent` ever ran. That is why `useTabItemContext`'s own "TabItem components must be used within a TabItem" throw never fired: no render, no warning, no DOM, just a tab strip over empty space. Four screens in Scaffald/SaaS believed that docstring, including the IPIP share-link page, where the reader is someone outside the account (Scaffald/SaaS#896, call sites fixed in Scaffald/SaaS#899). The prop was the trap, not the call sites. ## Two changes `value` is gone from `TabContentProps`, so the mistake is now a type error at every call site: error TS2322: Type '{ children: string; value: string; }' is not assignable to type 'IntrinsicAttributes & TabContentProps' A comment stands in its place explaining what it was and why it is not coming back, so nobody re-adds it from the old docstring. And the silent discard — the root defect — now warns in development, naming what was dropped and showing the shape that works. Type errors cannot catch every case: a `Tabs.Content` nested one level too deep, or a `Tabs.Item` with no trigger, both still reach that branch. Production is unaffected: the warning is behind `NODE_ENV !== 'production'`, and nothing about rendering changed. ## Tests `Tabs.droppedChildren.test.tsx` covers the bare-Content case warning and still not rendering, a non-Content dropped child, the supported nested shape staying silent, and — the one that keeps the warning usable — `{cond && <Tabs.Item/>}` evaluating to `false` NOT warning, so a conditionally-built strip is not noisy. 714 passed / 0 failed in this package; typecheck clean. The `noExplicitAny` warning biome reports in Tabs.types.ts is pre-existing on `getTriggerProps` (line 346 before this change) and untouched here. The formatting drift biome reports in the sibling Tabs files is also pre-existing and left alone rather than folded into this diff. Co-Authored-By: Claude Opus 5 <[email protected]>
thinkclay
added a commit
to Scaffald/SaaS
that referenced
this pull request
Sep 26, 2026
…#906) (#918) Scaffald/ui#42 is merged. `TabContentProps.value` is gone — the prop that was documented as associating a panel with a trigger and that nothing ever read — so writing `<Tabs.Content value="x">` is now a type error rather than an element silently discarded before it renders. `Tabs` also warns in development when it drops a direct child that has no `Tabs.Trigger` among its children. That is the root defect #906 was about: the `if (trigger)` branch used to skip such a child with no render, no warning and no DOM, which is why `useTabItemContext`'s "must be used within a TabItem" throw never fired and four screens shipped a tab strip over empty space (#896). No call sites change. #899 already nested every `Tabs.Content` in this repo inside its `Tabs.Item`, including the fourth site it had missed — the IPIP share-link page — so `Tabs.Content value=` appears nowhere outside the ui package's own stories, which use the nested form. Co-authored-by: Claude Opus 5 <[email protected]>
This was referenced Sep 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses Scaffald/SaaS#906.
TabContentPropsdeclared avalue, documented as associating a panel with a trigger "for Radix-style API — when the active tab value matches, this content is shown". Nothing read it.TabContentdecides purely onuseTabItemContext().isSelected, so a panel written in that shape — a sibling of the triggers rather than nested in itsTabs.Item— rendered nothing.It was silent as well as wrong.
Tabswalks its direct children looking for aTabTriggeramong each one's children and keeps the child onlyif (trigger). A bareTabs.Contenthas none, so it was discarded beforeTabContentever ran — which is whyuseTabItemContext's own'TabItem components must be used within a TabItem'throw never fired. No render, no warning, no DOM. Just a tab strip over empty space.Four screens in
Scaffald/SaaSbelieved that docstring, including the IPIP share-link page, where the reader is someone outside the account (Scaffald/SaaS#896; call sites fixed in Scaffald/SaaS#899). The prop was the trap, not the call sites — which is why that fix left this open.Two changes
1.
valueis gone, so the mistake is a type error at every call site:A comment stands where it was, explaining what it did and why it isn't coming back — otherwise the next person reads the old docstring in git history and re-adds it.
I went with removing rather than honouring it. Honouring would mean
Tabscollecting bareTabContentchildren and matching onvalue, which makes the docstring true but leaves two supported shapes to maintain forever. Every example, story and call site already uses the nested form, so the prop only ever added a way to be wrong.2. The silent discard now warns in development — the root defect. A type error can't catch every case: a
Tabs.Contentnested one level too deep, or aTabs.Itemwith no trigger, both still reach that branch. The warning names what was dropped and shows the shape that works.Production is unaffected — the warning is behind
NODE_ENV !== 'production', and nothing about rendering changed.Tests
Tabs.droppedChildren.test.tsx:Tabs.Contentwarns, mentionsTabs.ContentandTabs.Item(a warning that doesn't say what to do is half a warning)Tabs.Contentis named too{cond && <Tabs.Item/>}evaluating tofalsedoes not warnThat last one is what keeps the warning usable: without it, every conditionally-built tab strip would spam the console and the warning would get ignored — which is how it ends up silent again by another route.
714 passed / 0 failed in this package;
tsc --noEmitclean.Left alone deliberately
noExplicitAnywarning biome reports inTabs.types.tsis pre-existing, ongetTriggerProps(line 346 before this change).Tabsfiles (TabContent.tsx,TabItem.tsx,TabTrigger.tsx,Tabs.styles.ts,index.ts,useTabItem.ts,useTabs.ts). All pre-existing, none of them files this PR touches — folding a reformat of seven files into this diff would bury the two changes that matter.Needs a submodule pointer bump in
Scaffald/SaaSafter this merges.