diff --git a/packages/@react-spectrum/s2/src/Dialog.tsx b/packages/@react-spectrum/s2/src/Dialog.tsx index 5f0f206b304..2e61f88e184 100644 --- a/packages/@react-spectrum/s2/src/Dialog.tsx +++ b/packages/@react-spectrum/s2/src/Dialog.tsx @@ -10,7 +10,7 @@ * governing permissions and limitations under the License. */ -import {PopoverProps as AriaPopoverProps, composeRenderProps, Provider, Dialog as RACDialog, DialogProps as RACDialogProps} from 'react-aria-components'; +import {PopoverProps as AriaPopoverProps, composeRenderProps, OverlayTriggerStateContext, Provider, Dialog as RACDialog, DialogProps as RACDialogProps} from 'react-aria-components'; import {ButtonGroupContext} from './ButtonGroup'; import {CloseButton} from './CloseButton'; import {ContentContext, FooterContext, HeaderContext, HeadingContext, ImageContext} from './Content'; @@ -187,125 +187,126 @@ function DialogInner(props: DialogProps & DialogContextValue & {dialogRef: RefOb ref={props.dialogRef} style={props.UNSAFE_style} className={(props.UNSAFE_className || '') + dialogInner}> - {composeRenderProps(props.children, (children, {close}) => - // Render the children multiple times inside the wrappers we need to implement the layout. - // Each instance hides certain children so that they are all rendered in the correct locations. - (<> - {/* Hero image */} - - {children} - - {/* Top header: heading, header, dismiss button, and button group (in fullscreen dialogs). */} + {composeRenderProps(props.children, (children, {close}) => ( + // Render the children multiple times inside the wrappers we need to implement the layout. + // Each instance hides certain children so that they are all rendered in the correct locations. + // Reset OverlayTriggerStateContext so the buttons inside the dialog don't retain their hover state. + + {/* Hero image */} + + {children} + + {/* Top header: heading, header, dismiss button, and button group (in fullscreen dialogs). */} +
-
- - {children} - -
- {props.isDismissable && - - } -
- {/* Main content */} - - {children} - - {/* Footer and button group */} -
{children}
- ) - )} + {props.isDismissable && + + } +
+ {/* Main content */} + + {children} + + {/* Footer and button group */} +
+ + {children} + +
+
+ ))} ); }