Skip to content

Commit

Permalink
feat(dialog): Add new overlayProps to configure the dialog's overlay
Browse files Browse the repository at this point in the history
  • Loading branch information
mlaursen committed Jan 30, 2022
1 parent 10984f5 commit cfc30f0
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/dialog/src/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export interface BaseDialogProps
* A function used to close the dialog when the overlay is clicked or the
* escape key is pressed when the `modal` prop is not enabled.
*/
onRequestClose: () => void;
onRequestClose(): void;

/**
* The tab index for the sheet. This should normally stay at `-1`.
Expand Down Expand Up @@ -187,6 +187,13 @@ export interface BaseDialogProps
* conditionally render a navigation panel.
*/
component?: "div" | "nav";

/**
* Any additional props that should be passed to the `Overlay` element.
*
* @remarks \@since 5.0.0
*/
overlayProps?: Omit<HTMLAttributes<HTMLSpanElement>, "style" | "className">;
}

export type DialogProps = LabelRequiredForA11y<BaseDialogProps>;
Expand Down Expand Up @@ -319,6 +326,7 @@ export const Dialog = forwardRef<HTMLDivElement, DialogProps>(function Dialog(
disableFocusOnUnmount = false,
disableNestedDialogFixes = false,
onKeyDown,
overlayProps,
...props
},
nodeRef
Expand All @@ -345,6 +353,7 @@ export const Dialog = forwardRef<HTMLDivElement, DialogProps>(function Dialog(
overlayEl = (
<Overlay
id={`${id}-overlay`}
{...overlayProps}
style={overlayStyle}
className={cn("rmd-dialog-overlay", overlayClassName)}
hidden={overlayHidden || disableOverlay}
Expand Down

0 comments on commit cfc30f0

Please sign in to comment.