microsoft / fluentui-contrib

Monorepo for contributor extension packages to Fluent UI
MIT License
25 stars 26 forks source link

feat(react-draggable-dialog): add ref forwarding for DraggableDialogSurface #185

Closed torlye closed 2 weeks ago

torlye commented 3 weeks ago

In the newest released version of Fluent UI 9, the DialogSurface component must support ref forwarding. If DialogSurface is wrapped inside another component, then that component must support ref forwarding. See e.g. https://github.com/microsoft/fluentui/issues/31630

That is the case in this module, react-draggable-dialog. DraggableDialogSurface is a wrapper around DialogSurface. If using this module with the newest Fluent UI 9 build, it throws the following error:

Error: @fluentui/react-motion: Invalid child element.
Motion factories require a single child element to be passed. That element element should support ref forwarding i.e. it should be either an intrinsic element (e.g. div) or a component that uses React.forwardRef().

This pull request adds the necessary forwarded ref for the DraggableDialogSurface component.

torlye commented 3 weeks ago

@microsoft-github-policy-service agree company="Tietoevry"