Skip to content

feat(dialog): align component with fusion DS - FE-7151#7807

Open
DipperTheDan wants to merge 11 commits intomasterfrom
option-B-test-branch-for-dialog-DS-audit
Open

feat(dialog): align component with fusion DS - FE-7151#7807
DipperTheDan wants to merge 11 commits intomasterfrom
option-B-test-branch-for-dialog-DS-audit

Conversation

@DipperTheDan
Copy link
Copy Markdown
Contributor

@DipperTheDan DipperTheDan commented Feb 27, 2026

Proposed behaviour

Screenshot 2026-03-12 at 13 09 59 Screenshot 2026-03-12 at 13 09 40 Screenshot 2026-03-12 at 13 09 23 Screenshot 2026-03-12 at 13 09 08 Screenshot 2026-03-12 at 13 14 16

Current behaviour

Dialog is currently out of alignment with the Fusion DS.

Checklist

  • Commits follow our style guide
  • Related issues linked in commit messages if required
  • Screenshots are included in the PR if useful
  • All themes are supported if required
  • Unit tests added or updated if required
  • Playwright automation tests added or updated if required
  • Storybook added or updated if required
  • Translations added or updated (including creating or amending translation keys table in storybook) if required
  • Typescript d.ts file added or updated if required
  • Related docs have been updated if required

QA

  • Tested in provided StackBlitz sandbox/Storybook
  • Add new Playwright test coverage if required
  • Carbon implementation matches Design System/designs
  • UI Tests GitHub check reviewed if required

Additional context

Due to Dialog also being used in AdvancedColorPicker, Alert, Confirm and Pages, some styling updates will be seen in these components. I have confirmed that this is expected with UX and I have been assured that we can accept the changes in styling that will inevitably happen due to these audit changes.

Testing instructions

@DipperTheDan DipperTheDan self-assigned this Feb 27, 2026
@DipperTheDan DipperTheDan added DO NOT MERGE Work in progress This is a WIP PR so may not be ready for review labels Feb 27, 2026
@DipperTheDan DipperTheDan requested a review from Copilot March 2, 2026 14:36
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new Design-System-aligned Dialog implementation and converts the existing Dialog export into a legacy migration wrapper, updating docs/stories/tests and a couple of dependent components to match the new sizing/styling.

Changes:

  • Added a new Dialog implementation under src/components/dialog/__internal__/__next__/ (styles, config, stories, tests, Playwright CT) including a withDialogHeader HOC.
  • Replaced the old Dialog implementation with a wrapper that maps legacy props/sizes to the new API and emits deprecation warnings; moved Storybook entries under Deprecated/.
  • Updated consuming code/tests to reflect the new sizing/radius/background tokens (e.g. AdvancedColorPicker sizing, Alert/Confirm/Dialog tests).

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
src/components/dialog/dialog.test.tsx Updates legacy Dialog tests for wrapper behavior, size mapping coverage, and new background/padding assertions.
src/components/dialog/dialog.style.ts Removes the legacy styled-components implementation (superseded by __internal__/__next__).
src/components/dialog/dialog.stories.tsx Moves legacy Dialog stories under Deprecated/Dialog.
src/components/dialog/dialog.pw.tsx Updates Playwright expectations for new Dialog widths/radius and deprecation behavior.
src/components/dialog/dialog.mdx Adds deprecation warning content and links to the newer Dialog docs.
src/components/dialog/dialog.component.tsx Replaces legacy implementation with a migration wrapper around the new Dialog and adds legacy-to-new prop mapping.
src/components/dialog/dialog-test.stories.tsx Moves legacy Dialog test stories under Deprecated/Dialog/Test.
src/components/dialog/internal/next/index.ts Adds an index barrel for the new internal Dialog implementation.
src/components/dialog/internal/next/dialog.test.tsx Adds RTL coverage for the new Dialog implementation (sizes, accessibility, sticky footer, etc.).
src/components/dialog/internal/next/dialog.style.ts Adds new DS-token-based styles for the new Dialog (sizes, radius, keyline, footer/header behavior).
src/components/dialog/internal/next/dialog.stories.tsx Adds Storybook stories demonstrating new Dialog behavior and header variants.
src/components/dialog/internal/next/dialog.pw.tsx Adds Playwright CT coverage for the new Dialog implementation.
src/components/dialog/internal/next/dialog.mdx Adds docs for the newer Dialog implementation (Quick Start, sizes, accessibility, examples).
src/components/dialog/internal/next/dialog.config.ts Adds DS size config/tokens and types for the new Dialog.
src/components/dialog/internal/next/dialog.component.tsx Introduces the new Dialog component implementation (Modal/FocusTrap/header/footer/sticky small-screen logic).
src/components/dialog/internal/next/dialog-test.stories.tsx Adds test-oriented stories for the new Dialog implementation.
src/components/dialog/internal/next/dialog-header/dialog-header.test.tsx Adds RTL coverage for withDialogHeader and status heading variants.
src/components/dialog/internal/next/dialog-header/dialog-header.component.tsx Adds the withDialogHeader HOC and status icon heading rendering.
src/components/dialog/internal/next/components-test.pw.tsx Adds Playwright CT helper fixtures for the new Dialog stories/tests.
src/components/dialog-full-screen/dialog-full-screen.test.tsx Updates deprecation-warning assertions due to Dialog wrapper changes.
src/components/confirm/confirm.test.tsx Removes disableCancel-related tests (reflecting changed/removed behavior).
src/components/alert/alert.test.tsx Updates expected border-radius styling (now inherited from Dialog wrapper/new styles).
src/components/advanced-color-picker/advanced-color-picker.style.ts Switches StyledDialogContent import to the new Dialog’s internal styles.
src/components/advanced-color-picker/advanced-color-picker.component.tsx Changes Dialog size usage from legacy auto to small.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/dialog/__internal__/__next__/dialog.style.ts Outdated
Comment thread src/components/dialog/dialog.component.tsx Outdated
Comment thread src/components/dialog/__internal__/__next__/dialog.mdx Outdated
Comment thread src/components/dialog-full-screen/dialog-full-screen.test.tsx Outdated
Comment on lines 4 to 9
import { StyledColorOptions } from "../simple-color-picker/simple-color-picker.style";
import { StyledSimpleColor } from "../simple-color-picker/simple-color/simple-color.style";
import { StyledDialogContent } from "../dialog/dialog.style";
import { StyledDialogContent } from "../dialog/__internal__/__next__/dialog.style";
import Dialog from "../dialog/dialog.component";
import StyledIconButton from "../icon-button/icon-button.style";
import checkerBoardSvg from "../simple-color-picker/simple-color/checker-board.svg";
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importing StyledDialogContent from ../dialog/__internal__/__next__/dialog.style couples AdvancedColorPicker to Dialog’s internal implementation details. If Dialog’s internal structure changes again, this will break. Consider exposing the needed selector/styled export via a public dialog/__next__ entry point, or switch to targeting stable attributes (e.g. [data-element="dialog-content"]). Also note the existing ${StyledIconButton} overrides further down won’t apply now that Dialog’s close button is a Button in the new implementation.

Copilot uses AI. Check for mistakes.
Comment thread src/components/dialog/__internal__/__next__/dialog.component.tsx Outdated
Comment thread src/components/confirm/confirm.test.tsx
Comment thread src/components/alert/alert.test.tsx Outdated
Comment thread src/components/dialog/__internal__/__next__/dialog.style.ts Outdated
Comment thread src/components/dialog/__internal__/__next__/dialog.style.ts Outdated
};

const DialogPositioner = styled.div.attrs(
applyBaseTheme,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: fine to leave for now but we should have a wider conversation with the rest of the team about how we handle zindexing as ideally we drop the use of the legacy themes in the next versions

wrapperRef={containerRef}
>
<DialogPositioner
$size={size}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: nice one for handling the transitive props

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 26 out of 26 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/dialog/dialog.component.tsx Outdated
Comment thread src/components/dialog/dialog.component.tsx Outdated
Comment thread src/components/dialog/dialog.pw.tsx Outdated
Comment thread src/components/confirm/confirm.test.tsx
@DipperTheDan DipperTheDan force-pushed the option-B-test-branch-for-dialog-DS-audit branch 2 times, most recently from a022b01 to 1d0a5a5 Compare March 11, 2026 13:53
@DipperTheDan DipperTheDan requested a review from Copilot March 11, 2026 14:07
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 31 out of 31 changed files in this pull request and generated 6 comments.

Comments suppressed due to low confidence (1)

src/components/confirm/confirm.component.tsx:202

  • disableCancel previously disabled the close icon as well (there was a test covering this), but Confirm now only sets disableEscKey and leaves the close icon enabled. This changes cancellation behaviour for existing consumers relying on disableCancel to fully prevent cancelling. Consider restoring the old behaviour by disabling the close icon when disableCancel is true (and/or preventing onCancel via the close icon) and keeping Escape disabled too.
    <Dialog
      open={open}
      onCancel={onCancel}
      disableEscKey={disableCancel}
      subtitle={subtitle}
      title={getTitle()}
      role="alertdialog"
      size={size}
      showCloseIcon={showCloseIcon}
      topModalOverride={topModalOverride}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/components/dialog/__internal__/__next__/dialog.component.tsx
Comment thread src/components/advanced-color-picker/advanced-color-picker.style.ts
Comment thread src/components/dialog/dialog.component.tsx
Comment thread src/components/dialog/__internal__/__next__/dialog.component.tsx
Comment thread src/components/dialog/__internal__/__next__/dialog.component.tsx
@Sage Sage deleted a comment from Copilot AI Mar 11, 2026
@DipperTheDan DipperTheDan force-pushed the option-B-test-branch-for-dialog-DS-audit branch 2 times, most recently from f1f6e97 to 729b881 Compare March 12, 2026 11:51
@DipperTheDan DipperTheDan changed the title Option b test branch for dialog ds audit feat(dialog): align component with fusion DS - FE-7151 Mar 23, 2026
Copy link
Copy Markdown
Contributor

@edleeks87 edleeks87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there's a lot of tokens that are uppercase when they should be lower etc, there's also fallbacks which is preventing the undefined tokens from being caught

Comment thread src/components/alert/alert.pw.tsx Outdated
@@ -16,12 +16,12 @@ import { getDataElementByValue } from "../../../playwright/components";
const specialCharacters = [CHARACTERS.DIACRITICS, CHARACTERS.SPECIALCHARACTERS];
const viewportHeights = [250, 500, 650];
const viewportWidths = [
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: if these are already being captured in chromatic we don't need this

};

const applyDefaultPadding = () => css`
padding: 0 var(--spacing200);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: we should update these to use the new tokens if possible

`;

const hasPaddingProps = (props: PaddingProps) => {
return (
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: do we need to check this? Wouldn't it just override if we did the following

const applyContentPadding =
  (disableContentPadding = false) =>
  (props: PaddingProps) => {
    if (disableContentPadding) {
      return css`
        padding: 0;
      `;
    }

    return css`
      ${applyDefaultPadding()}

      ${padding}
    `;
  };

$size === "fullscreen"
? css`
flex: 1;
${applyContentPadding(Boolean(disableContentPadding))(props)}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: we shouldn't need to coerce to Boolean, there's a default value on the function but we dont' really need that as undefined is still falsy etc

box-shadow:
0 -2px 4px 0 rgba(0, 0, 0, 0.1),
0 -10px 60px 0 rgba(0, 0, 0, 0.1);
background: var(--container-standard-bg-default, #fff);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
background: var(--container-standard-bg-default, #fff);
background: var(--container-standard-bg-default);

flex-grow: 1;
padding: ${disableContentPadding
? "0px"
: "var(--spacing300) var(--spacing400)"};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: legacy tokens

box-sizing: border-box;
width: 100%;
height: var(--global-size-3XL, 72px);
padding-top: var(--global-space-comp-L, 16px);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
padding-top: var(--global-space-comp-L, 16px);
padding-top: var(--global-space-comp-l);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lower case needed here and fallbacks should be removed


const StyledDialogTitle = styled.div<StyledDialogTitleProps>`
background: var(--container-standard-bg-default, #fff);
padding: var(--global-space-comp-XL, 24px);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: same as above lowercase and no fallbacks etc

Comment thread src/components/dialog/dialog.pw.tsx Outdated
{ size: SIZE.MEDIUM, width: "750px" },
{ size: SIZE.MEDIUMLARGE, width: "850px" },
{ size: SIZE.LARGE, width: "960px" },
{ size: SIZE.EXTRASMALL, width: "540px" },
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment: similar to above this can be removed if there's chromatic


const meta: Meta<typeof Dialog> = {
title: "Dialog",
title: "Deprecated/Dialog",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
title: "Deprecated/Dialog",
title: "Dialog",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should show old and new in local/dev docs but only the public facing one in production etc. To the end consumer there shouldn't be a change when we remove legacy etc

padding: ${disableContentPadding
? "0px"
: "var(--spacing300) var(--spacing400)"};
: "var(--global-space-layout-xs) var(--global-space-layout-§s)"};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

css`
min-width: 288px;
max-width: var(--container-size-dialog-maxW-S, 540px);
max-width: 540px;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we check with UX/DS to confirm there's no appropriate tokens to use here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked with DS. They did have some originally but they were stripped out for hard coded values. I've let the DS know that we'd prefer token values incase these values need updating in future, it'll save us a manual job.

@DipperTheDan DipperTheDan force-pushed the option-B-test-branch-for-dialog-DS-audit branch 2 times, most recently from 96525d4 to 62e2273 Compare April 14, 2026 15:01
@DipperTheDan DipperTheDan force-pushed the option-B-test-branch-for-dialog-DS-audit branch 2 times, most recently from 06965f5 to 3f9df3c Compare April 27, 2026 13:06
@DipperTheDan DipperTheDan force-pushed the option-B-test-branch-for-dialog-DS-audit branch from 3f9df3c to d0a2997 Compare April 27, 2026 13:53
Comment thread src/components/dialog/__internal__/__next__/dialog.style.ts
Comment thread src/components/dialog/__internal__/__next__/dialog.config.ts
Comment thread jest.config.ts
Comment on lines +21 to +22
"^@sage/design-tokens-fusion/js/es6/(.*)$":
"@sage/design-tokens-fusion/js/common/$1",
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have had to add these here to avoid an error of SyntaxError: Unexpected token 'export' when running the test suite because Jest runs in a Node CJS environment and ignores node_modules by default, so the export const syntax in the ES6 token files is never transpiled.

@DipperTheDan DipperTheDan marked this pull request as ready for review April 29, 2026 15:13
@DipperTheDan DipperTheDan requested review from a team as code owners April 29, 2026 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants