Skip to content

feat(react-positioning): add placement to onPositioningEnd event#35773

Merged
robertpenner merged 7 commits intomicrosoft:masterfrom
robertpenner:feat/positioning-placement
Feb 23, 2026
Merged

feat(react-positioning): add placement to onPositioningEnd event#35773
robertpenner merged 7 commits intomicrosoft:masterfrom
robertpenner:feat/positioning-placement

Conversation

@robertpenner
Copy link
Collaborator

@robertpenner robertpenner commented Feb 23, 2026

The onPositioningEnd callback now receives a CustomEvent with detail.placement containing the computed Floating UI placement. This enables consumers (e.g. react-popover motion migration) to react to the final placement after flip/shift middleware adjustments.

Changes

  • types.ts: Define PositioningPlacement as a Fluent-owned string union equivalent to Floating UI's Placement type, avoiding leaking @floating-ui/dom into the public API surface. Add OnPositioningEndEventDetail and OnPositioningEndEvent types.
  • createPositionManager.ts: Dispatch fui-positioningend event with { detail: { placement } } after positioning completes.
  • usePositioning.ts: Forward the typed event through the onPositioningEnd callback.

API Surface

  • No changes to the public API report (react-positioning.api.md).
  • The new types are not exported from index.ts; they are reachable through the existing PositioningProps type.

Backwards Compatibility

  • The onPositioningEnd callback signature changed from () => void to (e: OnPositioningEndEvent) => void.
  • This is backwards compatible, as TypeScript allows functions with fewer parameters to be assigned where more parameters are expected.
  • There is a call site for onPositioningEnd in apps/vr-tests-react-components/src/stories/Positioning/Positioning.stories.tsx, and it remains free of type errors.

Testing

  • createPositionManager.test.ts (new, 14 tests) — detail.placement for all 12 placements, middleware adjustments, no dispatch after dispose.
  • usePositioning.test.tsx (new, 3 tests) — callback receives event, no error when omitted, () => void backwards compat.
  • types.test.ts (2 new tests) — both () => void and (e: OnPositioningEndEvent) => void accepted.

Future Work

  • This PR is a prerequisite for migrating react-popover from CSS animations (createSlideStyles) to Fluent motion components.
  • The popover needs to know the computed placement direction at the moment positioning completes in order to set slide direction CSS custom properties for the motion animation.

The onPositioningEnd callback now receives a CustomEvent with
detail.placement containing the computed Floating UI placement.
This enables consumers (e.g. react-popover motion) to react to
the final placement after flip/shift middleware adjustments.

- Define PositioningPlacement as a Fluent-owned string union
  equivalent to Floating UI's Placement, avoiding leaking
  @floating-ui/dom types into the public API surface
- Add OnPositioningEndEventDetail and OnPositioningEndEvent types
- Thread the event through createPositionManager and usePositioning
@robertpenner robertpenner requested a review from a team as a code owner February 23, 2026 17:46
@robertpenner robertpenner self-assigned this Feb 23, 2026
@github-actions
Copy link

github-actions bot commented Feb 23, 2026

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-charts
AreaChart
406.783 kB
124.495 kB
406.807 kB
124.502 kB
24 B
7 B
react-charts
DeclarativeChart
756.617 kB
217.631 kB
756.641 kB
217.639 kB
24 B
8 B
react-charts
DonutChart
317.224 kB
94.361 kB
317.248 kB
94.368 kB
24 B
7 B
react-charts
FunnelChart
308.774 kB
91.361 kB
308.798 kB
91.367 kB
24 B
6 B
react-charts
GanttChart
389.926 kB
118.05 kB
389.95 kB
118.062 kB
24 B
12 B
react-charts
GaugeChart
316.655 kB
93.799 kB
316.679 kB
93.808 kB
24 B
9 B
react-charts
GroupedVerticalBarChart
397.772 kB
120.667 kB
397.796 kB
120.68 kB
24 B
13 B
react-charts
HeatMapChart
391.973 kB
119.859 kB
391.997 kB
119.866 kB
24 B
7 B
react-charts
HorizontalBarChart
296.951 kB
86.138 kB
296.975 kB
86.151 kB
24 B
13 B
react-charts
Legends
235.905 kB
69.363 kB
235.929 kB
69.375 kB
24 B
12 B
react-charts
LineChart
417.347 kB
126.389 kB
417.371 kB
126.401 kB
24 B
12 B
react-charts
PolarChart
345.84 kB
105.418 kB
345.864 kB
105.432 kB
24 B
14 B
react-charts
SankeyChart
213.881 kB
65.62 kB
213.905 kB
65.63 kB
24 B
10 B
react-charts
ScatterChart
397.174 kB
120.59 kB
397.198 kB
120.602 kB
24 B
12 B
react-charts
VerticalBarChart
434.249 kB
126.27 kB
434.273 kB
126.284 kB
24 B
14 B
react-charts
VerticalStackedBarChart
403.686 kB
121.535 kB
403.71 kB
121.548 kB
24 B
13 B
react-combobox
Combobox (including child components)
105.184 kB
34.163 kB
105.208 kB
34.168 kB
24 B
5 B
react-combobox
Dropdown (including child components)
105.808 kB
34.095 kB
105.832 kB
34.1 kB
24 B
5 B
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
237.306 kB
68.52 kB
237.33 kB
68.535 kB
24 B
15 B
react-components
react-components: entire library
1.291 MB
322.971 kB
1.291 MB
322.985 kB
24 B
14 B
react-datepicker-compat
DatePicker Compat
225.014 kB
63.584 kB
225.038 kB
63.595 kB
24 B
11 B
react-menu
Menu (including children components)
163.727 kB
49.539 kB
163.751 kB
49.55 kB
24 B
11 B
react-menu
Menu (including selectable components)
166.905 kB
50.129 kB
166.929 kB
50.14 kB
24 B
11 B
react-popover
Popover
127.2 kB
39.256 kB
127.224 kB
39.264 kB
24 B
8 B
react-positioning
usePositioning
28.865 kB
10.146 kB
28.889 kB
10.158 kB
24 B
12 B
react-tag-picker
@fluentui/react-tag-picker - package
186.572 kB
55.852 kB
186.596 kB
55.849 kB
24 B
-3 B
react-teaching-popover
TeachingPopover
102.017 kB
30.539 kB
102.041 kB
30.544 kB
24 B
5 B
react-timepicker-compat
TimePicker
108.15 kB
35.693 kB
108.174 kB
35.695 kB
24 B
2 B
react-tooltip
Tooltip
57.076 kB
19.688 kB
57.1 kB
19.696 kB
24 B
8 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-avatar
Avatar
48.27 kB
15.312 kB
react-avatar
AvatarGroup
17.45 kB
6.995 kB
react-avatar
AvatarGroupItem
61.511 kB
19.296 kB
react-breadcrumb
@fluentui/react-breadcrumb - package
114.911 kB
31.405 kB
react-charts
HorizontalBarChartWithAxis
63 B
83 B
react-charts
Sparkline
91.393 kB
28.708 kB
react-checkbox
Checkbox
33.522 kB
11.407 kB
react-components
react-components: Button, FluentProvider & webLightTheme
70.397 kB
19.96 kB
react-components
react-components: FluentProvider & webLightTheme
43.612 kB
14.022 kB
react-dialog
Dialog (including children components)
102.078 kB
30.379 kB
react-field
Field
21.925 kB
8.257 kB
react-input
Input
26.246 kB
8.688 kB
react-list
List
87.11 kB
25.762 kB
react-list
ListItem
110.695 kB
32.627 kB
react-overflow
hooks only
12.117 kB
4.627 kB
react-persona
Persona
55.225 kB
17.245 kB
react-portal-compat
PortalCompatProvider
8.386 kB
2.624 kB
react-positioning
useSafeZoneArea
12.445 kB
5 kB
react-progress
ProgressBar
15.7 kB
6.214 kB
react-radio
Radio
30.905 kB
9.611 kB
react-radio
RadioGroup
13.994 kB
5.688 kB
react-select
Select
26.085 kB
9.437 kB
react-slider
Slider
36.322 kB
12.065 kB
react-spinbutton
SpinButton
33.637 kB
11.067 kB
react-swatch-picker
@fluentui/react-swatch-picker - package
104.27 kB
29.925 kB
react-switch
Switch
34.536 kB
10.832 kB
react-table
DataGrid
159.313 kB
44.939 kB
react-table
Table (Primitives only)
40.997 kB
13.172 kB
react-table
Table as DataGrid
130.528 kB
35.943 kB
react-table
Table (Selection only)
68.916 kB
19.309 kB
react-table
Table (Sort only)
67.559 kB
18.924 kB
react-tags
InteractionTag
13.666 kB
5.459 kB
react-tags
Tag
29.521 kB
9.389 kB
react-tags
TagGroup
82.211 kB
24.143 kB
react-textarea
Textarea
24.628 kB
8.954 kB
react-tree
FlatTree
147.635 kB
42.134 kB
react-tree
PersonaFlatTree
149.463 kB
42.517 kB
react-tree
PersonaTree
145.523 kB
41.338 kB
react-tree
Tree
143.701 kB
40.972 kB
🤖 This report was generated against 30d6910a06d897e9b2ce2f3f326150f5e01bf52e

@github-actions
Copy link

Pull request demo site: URL

@robertpenner robertpenner force-pushed the feat/positioning-placement branch from a92822b to d1682ff Compare February 23, 2026 21:49
@robertpenner robertpenner enabled auto-merge (squash) February 23, 2026 21:49
@robertpenner robertpenner merged commit cbf0ef2 into microsoft:master Feb 23, 2026
12 checks passed
@robertpenner robertpenner deleted the feat/positioning-placement branch February 23, 2026 22:25
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.

2 participants