feat(headless): add autoSize for headless positioning API - #36662
Draft
Victor Genaev (mainframev) wants to merge 1 commit into
Draft
feat(headless): add autoSize for headless positioning API#36662Victor Genaev (mainframev) wants to merge 1 commit into
Victor Genaev (mainframev) wants to merge 1 commit into
Conversation
📊 Bundle size reportUnchanged fixtures
|
|
Pull request demo site: URL |
| @@ -0,0 +1,7 @@ | |||
| { | |||
There was a problem hiding this comment.
🕵🏾♀️ visual changes to review in the Visual Change Report
vr-tests-react-components/Avatar Converged 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Avatar Converged.badgeMask.normal.chromium.png | 3 | Changed |
vr-tests-react-components/Menu Converged - submenuIndicator slotted content 1 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Menu Converged - submenuIndicator slotted content.default - RTL.submenus open.chromium.png | 404 | Changed |
vr-tests-react-components/Positioning 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/Positioning.Positioning end.chromium.png | 897 | Changed |
| vr-tests-react-components/Positioning.Positioning end.updated 2 times.chromium.png | 498 | Changed |
vr-tests-react-components/ProgressBar converged 2 screenshots
| Image Name | Diff(in Pixels) | Image Type |
|---|---|---|
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness - High Contrast.default.chromium.png | 173 | Changed |
| vr-tests-react-components/ProgressBar converged.Indeterminate + thickness.default.chromium.png | 137 | Changed |
Victor Genaev (mainframev)
force-pushed
the
feat/headless-pos-autosize
branch
4 times, most recently
from
September 1, 2026 10:25
8a80a2b to
b2cfaeb
Compare
Victor Genaev (mainframev)
force-pushed
the
feat/headless-pos-autosize
branch
from
September 1, 2026 10:34
b2cfaeb to
aae7ab7
Compare
Copilot started reviewing on behalf of
Victor Genaev (mainframev)
September 1, 2026 11:48
View session
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds autoSize support to the headless preview positioning hook by reusing (and now publicly exporting) normalizeAutoSize from @fluentui/react-positioning, plus new measurement logic to derive available space from the anchor + viewport and apply logical max-* constraints.
Changes:
- Exposes
normalizeAutoSize(andNormalizedAutoSize) from@fluentui/react-positioningpublic entrypoint and updates API report. - Implements headless
autoSizevia a newuseAutoSizehook andcomputeAvailableSizeutilities, integrating it into the existing placement observer. - Adds Storybook docs/stories and Jest + Cypress coverage for
autoSizebehavior and edge cases.
Reviewed changes
Copilot reviewed 23 out of 23 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/react-components/react-positioning/library/src/index.ts | Re-exports normalizeAutoSize (and NormalizedAutoSize) from the package entrypoint. |
| packages/react-components/react-positioning/library/etc/react-positioning.api.md | API report updated to include normalizeAutoSize and NormalizedAutoSize. |
| packages/react-components/react-headless-components-preview/stories/src/Concepts/Positioning/utils.stories.tsx | Updates supported props list so Storybook args include autoSize. |
| packages/react-components/react-headless-components-preview/stories/src/Concepts/Positioning/PositioningAutoSizeDescription.md | Adds user-facing docs describing autoSize behavior and requirements. |
| packages/react-components/react-headless-components-preview/stories/src/Concepts/Positioning/PositioningAutoSize.stories.tsx | New story exercising autoSize with overflowing content. |
| packages/react-components/react-headless-components-preview/stories/src/Concepts/Positioning/positioning.module.css | Adds styling for the new autoSize story surface/content. |
| packages/react-components/react-headless-components-preview/stories/src/Concepts/Positioning/index.stories.tsx | Registers the new AutoSize story. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/utils/offset.ts | Tightens resolveOffset return type to Required<OffsetObject>. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/utils/index.ts | Re-exports newly added available-size utilities/types. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/utils/computeAvailableSize.ts | New utility to compute available block/inline size from anchor + viewport. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/utils/computeAvailableSize.test.ts | Unit tests for available-size computation and boundary measurement. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/usePositioning.ts | Integrates autoSize into headless positioning and refines center-alignment workaround. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/usePositioning.test.tsx | Adds alignment parameterized tests and comprehensive Jest coverage for autoSize. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/usePlacementObserver.ts | Adds onUpdate callback to reuse observer ticks for auto-size updates. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/useAutoSize.ts | New hook that applies/removes logical max-* constraints and overflow ownership. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/types.ts | Extends headless PositioningProps to include autoSize. |
| packages/react-components/react-headless-components-preview/library/src/hooks/usePositioning/types.test.ts | Ensures PositioningProps accepts the canonical AutoSize values. |
| packages/react-components/react-headless-components-preview/library/src/components/Popover/Popover.cy.tsx | Adds Cypress coverage for autoSize (guarded by anchor-positioning support). |
| packages/react-components/react-headless-components-preview/library/etc/positioning.api.md | Updates API report to include autoSize on exported PositioningProps. |
| packages/react-components/react-headless-components-preview/library/docs/popover-spec.md | Updates spec doc with autoSize behavior + limitations, and clarifies alignment workaround. |
| packages/react-components/react-headless-components-preview/library/config/tests.cjs | Adds CSS.supports shim for JSDOM so feature-gated paths can be tested. |
| change/@fluentui-react-positioning-eabe93ba-61eb-4d74-9975-7bbdf563ce9b.json | Beachball change file for the new public export. |
| change/@fluentui-react-headless-components-preview-11a7a26b-d650-4d75-b17e-cb9d56a242fc.json | Beachball change file for the headless autoSize feature. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| overflowProperty: string, | ||
| owned: boolean, | ||
| ): boolean { | ||
| if (!enabled || size <= 0) { |
| @@ -0,0 +1,6 @@ | |||
| { | |||
| "type": "minor", | |||
| "comment": "feat: expose normalizeAutosize", | |||
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.

No description provided.