Skip to content

feat(react-toolbar): expose base hooks and types for Toolbar components#35903

Merged
dmytrokirpa merged 3 commits intomicrosoft:masterfrom
dmytrokirpa:feat/react-toolbar-expose-base-hooks
Apr 21, 2026
Merged

feat(react-toolbar): expose base hooks and types for Toolbar components#35903
dmytrokirpa merged 3 commits intomicrosoft:masterfrom
dmytrokirpa:feat/react-toolbar-expose-base-hooks

Conversation

@dmytrokirpa
Copy link
Copy Markdown
Contributor

Summary

  • Exports useToolbarBase_unstable, ToolbarBaseProps, ToolbarBaseState
  • Exports useToolbarButtonBase_unstable, ToolbarButtonBaseProps, ToolbarButtonBaseState
  • Exports useToolbarDividerBase_unstable, ToolbarDividerBaseProps, ToolbarDividerBaseState
  • Exports useToolbarRadioButtonBase_unstable, ToolbarRadioButtonBaseProps, ToolbarRadioButtonBaseState
  • Exports useToolbarToggleButtonBase_unstable, ToolbarToggleButtonBaseProps, ToolbarToggleButtonBaseState
  • Updates renderToolbar_unstable to accept ToolbarBaseState instead of ToolbarState — the render only uses state.root.children which is present in the base state

All hooks and types were already implemented in the component source files (added in PR #35658) but gated behind comments in index.ts.

Tracking: #35562

🤖 Generated with Claude Code

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 25, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-components
react-components: entire library
1.3 MB
324.989 kB
1.3 MB
325.036 kB
218 B
47 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Button, FluentProvider & webLightTheme
70.397 kB
19.96 kB
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.187 kB
68.891 kB
react-components
react-components: FluentProvider & webLightTheme
43.612 kB
14.022 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-timepicker-compat
TimePicker
108.977 kB
36.038 kB
🤖 This report was generated against 48b4b08faa9f6e5c86cc8dadf744a40f970f8fbd

@github-actions
Copy link
Copy Markdown

Pull request demo site: URL

@dmytrokirpa dmytrokirpa force-pushed the feat/react-toolbar-expose-base-hooks branch from fc76df2 to 80ea1e9 Compare March 26, 2026 20:11
@dmytrokirpa dmytrokirpa marked this pull request as ready for review March 29, 2026 16:30
@dmytrokirpa dmytrokirpa requested review from a team and chpalac as code owners March 29, 2026 16:30
@dmytrokirpa dmytrokirpa self-assigned this Mar 29, 2026
@dmytrokirpa dmytrokirpa force-pushed the feat/react-toolbar-expose-base-hooks branch from aff6b2a to 51bf3d3 Compare April 15, 2026 12:24
Copy link
Copy Markdown
Member

@layershifter layershifter left a comment

Choose a reason for hiding this comment

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

Default vs user props overrides

It's a bit tricky to review these changes as a small change in order could break things. As we have already faced regressions before (#35710), please cover matching changes with UTs (use linked PR for reference)

Thx

@dmytrokirpa dmytrokirpa force-pushed the feat/react-toolbar-expose-base-hooks branch from 51bf3d3 to 16640c7 Compare April 21, 2026 04:34
layershifter added a commit to layershifter/office-ui-fabric-react that referenced this pull request Apr 21, 2026
…utput

Adds the test cases flagged during review of PR microsoft#35903:

- useToolbarButton: pin current behavior that user-supplied `size` is
  dropped (hard-forced to 'medium') while `shape` propagates through.
  If either changes, the assertion flips.
- useToolbar: assert `aria-orientation` is omitted for horizontal
  toolbars and confirm Tabster arrow-navigation attributes are present
  on the root of the non-base hook.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
layershifter added a commit to layershifter/office-ui-fabric-react that referenced this pull request Apr 21, 2026
…utput

Adds the test cases flagged during review of PR microsoft#35903:

- useToolbarButton: pin current behavior that user-supplied `size` is
  dropped (hard-forced to 'medium') while `shape` propagates through.
  If either changes, the assertion flips.
- useToolbar: assert `aria-orientation` is omitted for horizontal
  toolbars and confirm Tabster arrow-navigation attributes are present
  on the root of the non-base hook.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
layershifter added a commit to layershifter/office-ui-fabric-react that referenced this pull request Apr 21, 2026
Cherry-picks the test files from PR microsoft#35903 (excluding production code
changes). Two ToolbarToggleButton assertions are adjusted to match
current master behavior rather than the PR's fixed behavior — these
document the spread-order bug where useToggleButton_unstable's
'secondary' default overrides the toolbar's 'subtle' default and
suppresses user-supplied appearance. When the PR code lands, these
assertions will need flipping, signalling the behavior change.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
layershifter added a commit to layershifter/office-ui-fabric-react that referenced this pull request Apr 21, 2026
…utput

Adds the test cases flagged during review of PR microsoft#35903:

- useToolbarButton: pin current behavior that user-supplied `size` is
  dropped (hard-forced to 'medium') while `shape` propagates through.
  If either changes, the assertion flips.
- useToolbar: assert `aria-orientation` is omitted for horizontal
  toolbars and confirm Tabster arrow-navigation attributes are present
  on the root of the non-base hook.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
layershifter added a commit to layershifter/office-ui-fabric-react that referenced this pull request Apr 21, 2026
Adds the useToolbar test cases flagged during review of PR microsoft#35903:

- `aria-orientation` is omitted on the root when the toolbar is
  horizontal.
- The non-base hook wires Tabster arrow-navigation attributes onto the
  root; locked via inline snapshot so any upstream config change shows
  up in the diff.

Size/shape overrides on ToolbarButton were considered but dropped —
ToolbarButtonProps doesn't expose either prop, so asserting their
runtime behavior would only pin implementation detail for an API that
cannot be reached from TypeScript.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
layershifter added a commit that referenced this pull request Apr 21, 2026
…35903 (#36021)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@layershifter
Copy link
Copy Markdown
Member

layershifter commented Apr 21, 2026

@dmytrokirpa thx for adding tests, I merged them in #36021. Can you please rebase? Thx

@dmytrokirpa dmytrokirpa force-pushed the feat/react-toolbar-expose-base-hooks branch from 1024ec9 to f8b3459 Compare April 21, 2026 13:44
@dmytrokirpa dmytrokirpa merged commit c93849c into microsoft:master Apr 21, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants