Skip to content

Commit cb1b957

Browse files
fix(modal): change modal background color to transparent (#3604)
* refactor(modal): update modal background color to transparent - adds documentation to modal docs page - updates metadata.json * docs(dialog): remove custom modal style - removes the customStyles object that was setting --mod-modal- background-color in the dialog template - removes the custom wrapper styles in the dialog tests that were intending to set the dialog apart from the modal - remove a duplicate isOpen control in dialog.stories.js * chore(modal): create changeset
1 parent 27e7bfc commit cb1b957

File tree

8 files changed

+11
-14
lines changed

8 files changed

+11
-14
lines changed

.changeset/polite-moments-stay.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@spectrum-css/modal": patch
3+
---
4+
5+
In Spectrum 2, elements that would typically be children of a modal (like dialogs, alert dialogs, and tray) have background-color token specs defined. Because modal _also_ had a defined background color, there was some antialiasing bleed-through happening on the corners, since both the modal and its child now had background colors on top of each other. `--spectrum-modal-background-color` is now redefined as `transparent` to avoid these conflicts in S2. `--mod-modal-background-color` is still available to consumers.

components/dialog/stories/dialog.stories.js

-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ export default {
9090
options: ["default", "fullscreen", "fullscreenTakeover"],
9191
control: "select",
9292
},
93-
isOpen,
9493
isDismissible: {
9594
name: "Dismissible",
9695
type: { name: "boolean" },

components/dialog/stories/dialog.test.js

-8
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ export const DialogGroup = Variants({
1616
// TODO: The dialog's heading arg is getting passed as the "Sizing" heading arg (instead of the
1717
// TODO: word "Sizing"). We should be able to remove this arg once that no longers happens.
1818
heading: showTestingGrid ? "Lorem ipsum dolor sit amet, consectetur adipiscing elit" : args.heading,
19-
customStyles: {
20-
...(args.customStyles ?? {}),
21-
"background-color": showTestingGrid ? "var(--spectrum-gray-100)" : undefined,
22-
},
2319
}, context);
2420
},
2521
sizeDirection: "column",
@@ -66,7 +62,6 @@ export const DialogFullscreen = Variants({
6662
*/
6763
customStyles: {
6864
margin: showTestingGrid ? "16px" : undefined,
69-
"background-color": showTestingGrid ? "var(--spectrum-gray-100)" : undefined,
7065
},
7166
}, context);
7267
},
@@ -85,9 +80,6 @@ export const DialogFullscreen = Variants({
8580
export const DialogFullscreenTakeover = Variants({
8681
Template,
8782
withSizes: false,
88-
wrapperStyles: {
89-
"background-color": "var(--spectrum-gray-50)"
90-
},
9183
testData: [
9284
{
9385
showModal: false,

components/dialog/stories/template.js

-3
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,6 @@ export const Template = ({
171171
isOpen,
172172
content: Dialog,
173173
variant: layout,
174-
customStyles: {
175-
"--mod-modal-background-color": "transparent"
176-
},
177174
}, context);
178175
}
179176
else {

components/modal/dist/metadata.json

-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
"--spectrum-animation-ease-out",
4646
"--spectrum-corner-radius-extra-large-default",
4747
"--spectrum-dialog-confirm-entry-animation-distance",
48-
"--spectrum-gray-75",
4948
"--spectrum-window-to-edge"
5049
],
5150
"passthroughs": [],

components/modal/index.css

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
--spectrum-modal-max-height: 90vh;
2525
--spectrum-modal-max-width: 90%;
2626

27-
--spectrum-modal-background-color: var(--mod-modal-background-color, var(--spectrum-gray-75));
27+
--spectrum-modal-background-color: var(--mod-modal-background-color, transparent);
2828
--spectrum-modal-confirm-border-radius: var(--mod-modal-confirm-border-radius, var(--spectrum-corner-radius-extra-large-default));
2929

3030
--spectrum-modal-transition-animation-duration: var(--mod-modal-transition-animation-duration, var(--spectrum-animation-duration-100));

components/modal/stories/modal.stories.js

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ export default {
5757
],
5858
};
5959

60+
/**
61+
* The default modal does not include a background color itself, other than `transparent`. If implementations are in need of a background color, and one is not supported within the modal's child component (for example, the dialog defines its own background color), `--mod-modal-background-color` may be set on the `.spectrum-Modal` class.
62+
*/
6063
export const Default = ModalGroup.bind({});
6164
Default.args = {
6265
content: [

components/picker/dist/metadata.json

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
"--spectrum-picker-border-color-active",
153153
"--spectrum-picker-border-color-default",
154154
"--spectrum-picker-border-color-default-open",
155+
"--spectrum-picker-border-color-disabled",
155156
"--spectrum-picker-border-color-error-active",
156157
"--spectrum-picker-border-color-error-default",
157158
"--spectrum-picker-border-color-error-default-open",
@@ -277,6 +278,7 @@
277278
"--spectrum-font-size-75",
278279
"--spectrum-gray-100",
279280
"--spectrum-gray-200",
281+
"--spectrum-gray-300",
280282
"--spectrum-gray-500",
281283
"--spectrum-gray-600",
282284
"--spectrum-gray-700",

0 commit comments

Comments
 (0)