diff --git a/src/components/dialog/dialog.component.tsx b/src/components/dialog/dialog.component.tsx index 7600e02db0..ea871a2306 100644 --- a/src/components/dialog/dialog.component.tsx +++ b/src/components/dialog/dialog.component.tsx @@ -128,6 +128,9 @@ export const Dialog = forwardRef( topModalOverride, closeButtonDataProps, restoreFocusOnClose = true, + "aria-labelledby": ariaLabelledBy, + "aria-describedby": ariaDescribedBy, + "aria-label": ariaLabel, ...rest }, ref, @@ -197,12 +200,10 @@ export const Dialog = forwardRef( size, dialogHeight, "aria-labelledby": - title && typeof title === "string" ? titleId : rest["aria-labelledby"], + title && typeof title === "string" ? titleId : ariaLabelledBy, "aria-describedby": - subtitle && typeof subtitle === "string" - ? subtitleId - : rest["aria-describedby"], - "aria-label": rest["aria-label"], + subtitle && typeof subtitle === "string" ? subtitleId : ariaDescribedBy, + "aria-label": ariaLabel, }; return ( @@ -214,6 +215,7 @@ export const Dialog = forwardRef( className={className ? `${className} carbon-dialog` : "carbon-dialog"} topModalOverride={topModalOverride} restoreFocusOnClose={restoreFocusOnClose} + {...rest} > { }); }); + [true, false].forEach((enableBackgroundUIValue) => { + test(`verify visibility of backgroundUILocatorElement when enableBackgroundUI prop is set to ${enableBackgroundUIValue}`, async ({ + mount, + page, + }) => { + await mount( + , + ); + + const backgroundUILocatorElement = backgroundUILocator(page); + + if (enableBackgroundUIValue) { + await expect(backgroundUILocatorElement).not.toBeVisible(); + } else { + await expect(backgroundUILocatorElement).toBeVisible(); + } + }); + }); + test("when showCloseIcon prop is false, should not render close icon", async ({ mount, page,