Skip to content

fix(react-headless-components-preview): publish context readers from the avatar-group, button, link and avatar subpaths - #36670

Open
Ray Knight (ArrayKnight) wants to merge 2 commits into
microsoft:masterfrom
ArrayKnight:fix/headless-subpath-context-readers-36652
Open

fix(react-headless-components-preview): publish context readers from the avatar-group, button, link and avatar subpaths#36670
Ray Knight (ArrayKnight) wants to merge 2 commits into
microsoft:masterfrom
ArrayKnight:fix/headless-subpath-context-readers-36652

Conversation

@ArrayKnight

@ArrayKnight Ray Knight (ArrayKnight) commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Several headless subpaths publish a context's values hook and its types but not the reader — so a consumer composing their own parts cannot read what the subpath's own render functions already provide. For Button/Link/Avatar the provider side was already correct: the headless renderers are verbatim re-exports of Griffel's and already wrap subtrees in Griffel's ButtonContextProvider / LinkContextProvider / AvatarContextProvider. Because those are Griffel's own context instances, a locally-declared context can never receive the values — a re-export is the only fix available to a consumer. One measured symptom: a composed Button inside a headless MessageBarActions rendered medium where the @fluentui/react-components equivalent renders small, because the size the provider was already publishing was unreachable.

This adds dedicated context re-export modules for AvatarGroup (reader + provider), Button, Link and Avatar — the shape Toolbar/useToolbar.ts already uses — plus the matching barrel and subpath entries, and regenerates the affected etc/*.api.md reports. Additive only; nothing that exists today changes meaning.

The issue also inventories three further sites with the same gap (TagGroup, InteractionTag, Accordion) that are not part of this PR, so the audit trail stays in one place.

Fixes #36652.

Extracted from #36656 per maintainer request — each in-tree fix from that PR as an isolated change.

…the avatar-group, button, link and avatar subpaths

Several headless subpaths publish a context's values hook and types but
not its reader, so a consumer composing their own parts cannot read what
the subpath's own render functions already provide. The providers in the
tree are Griffel's own context instances (the headless renderers are
verbatim re-exports), so a locally-declared context can never receive
the values — a re-export is the only fix available to a consumer.

Adds dedicated context re-export modules for AvatarGroup, Button, Link
and Avatar (mirroring the shape Toolbar/useToolbar.ts already uses),
plus the matching barrel and subpath entries, and regenerates the
affected etc/*.api.md reports. Additive only.

Extracted from windmod branch commits 5a89364 and 9612d54
(headless hunks only).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Aj9uA3rCVgosnh2zNn8qkc
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-headless-components-preview
react-headless-components-preview: entire library
238.991 kB
67.288 kB
239.464 kB
67.428 kB
473 B
140 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-headless-components-preview
@fluentui/react-headless-components-preview/tag-picker
53.988 kB
17.748 kB
react-headless-components-preview
@fluentui/react-headless-components-preview/teaching-popover
36.048 kB
11.996 kB
🤖 This report was generated against 49c0291821bfa7e2ef29514685a666198001ac73

@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown

Pull request demo site: URL

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets remove the unnecessary use client directives and comments. Otherwise, it looks ready to go. Thanks for the contribution!

@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: publish context readers (and providers where the package owns them) from the avatar-group, button, link and avatar subpaths so consumers can read the look context the package's own renderers provide",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: could we simlpify/shorten this a bit?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — shortened the change-file description to one sentence in 28f58bc.

@@ -0,0 +1,17 @@
'use client';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we might not need the use client directive here is it's just a re-export, not an actual hook

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — removed use client from buttonContext.ts and the other three same-shape re-export files (avatarContext, avatarGroupContext, linkContext) in 28f58bc.

@@ -0,0 +1,17 @@
'use client';

/**

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets cleanup the comment as it too verbose and probably unnecessary

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — trimmed the comment to one line, and the same-shape comments in the other three context files, in 28f58bc.

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

Projects

None yet

2 participants