Closed
Conversation
f8a6f74 to
2970171
Compare
2970171 to
e644b39
Compare
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.
Add experimental @fluentui-contrib/react-popover package
Summary
This PR introduces a new experimental Popover component that reimagines the FluentUI React v9 Popover using modern web platform APIs. The component maintains API compatibility with the standard Popover while leveraging native browser capabilities for improved performance and reduced bundle size.
Motivation
Modern browsers have introduced powerful native APIs for common UI patterns that were previously only achievable with JavaScript libraries. This experimental package explores what a future Popover implementation could look like by replacing third-party dependencies with platform primitives:
Popover API replaces custom popover management logic
CSS Anchor Positioning replaces floating-ui for positioning
Focusgroup API replaces react-tabster for keyboard navigation
Key Features
✨ Native popover behavior - Uses the browser's built-in Popover API for better performance and accessibility
✨ CSS-native positioning - Anchor positioning with automatic fallbacks when popover would overflow viewport
✨ Zero-dependency positioning - No floating-ui required, reducing bundle size
✨ API compatibility - Drop-in replacement for standard FluentUI Popover (same props, same patterns)
✨ Modern CSS techniques - Uses anchor-size() with margin-based centering for reliable positioning that works with position-try-fallbacks
Technical Highlights
CSS Anchor Positioning Implementation
The positioning system uses modern CSS features with proper fallback handling:
This approach avoids the common pitfall of using transform:
translateX(-50%)which doesn't work correctly withposition-try-fallbacksbecause transforms are applied after fallback calculations.Browser Support
Caution
This is an experimental package with limited browser support. It requires:
Only use this component when targeting modern browsers. For production applications requiring broad compatibility, continue using the standard @fluentui/react-popover.
API Example
Component Structure:
Popover- Root component managing statePopoverTrigger- Wraps the trigger elementPopoverSurface- The popover content surface with positioningSupported Positions
All standard FluentUI positioning options are supported:
Future Considerations
This experimental package serves as a proof-of-concept for how FluentUI components might evolve as web platform APIs mature. Feedback and real-world testing will help inform whether these approaches should be adopted in the main library.