diff --git a/packages/components/src/card/styles.js b/packages/components/src/card/styles.js
index 4ecd3a09105d87..c8ce8f32b21f5b 100644
--- a/packages/components/src/card/styles.js
+++ b/packages/components/src/card/styles.js
@@ -9,8 +9,20 @@ import { css } from '@emotion/react';
import { COLORS, CONFIG } from '../utils';
export const Card = css`
- box-shadow: 0 0 0 1px ${ CONFIG.surfaceBorderColor };
outline: none;
+
+ &::before {
+ content: '';
+
+ box-shadow: inset 0 0 0 1px ${ CONFIG.surfaceBorderColor };
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+
+ pointer-events: none;
+ }
`;
export const Header = css`
@@ -77,7 +89,9 @@ export const borderColor = css`
`;
export const boxShadowless = css`
- box-shadow: none;
+ &::before {
+ content: none;
+ }
`;
export const borderless = css`
diff --git a/packages/components/src/card/test/__snapshots__/index.js.snap b/packages/components/src/card/test/__snapshots__/index.js.snap
index adf11cff8056a3..8527ab716c4320 100644
--- a/packages/components/src/card/test/__snapshots__/index.js.snap
+++ b/packages/components/src/card/test/__snapshots__/index.js.snap
@@ -157,8 +157,8 @@ Snapshot Diff:
@@ -1,30 +1,30 @@
@@ -191,6 +191,23 @@ Snapshot Diff:
`;
+exports[`Card Card component should remove borders when the isBorderless prop is true 1`] = `
+Snapshot Diff:
+- First value
++ Second value
+
+@@ -1,8 +1,8 @@
+
+
+
{
} );
it( 'should remove borders when the isBorderless prop is true', () => {
- const { rerender, container } = render(
+ const { container: withBorders } = render(
Code is Poetry
);
- expect( container.firstChild ).not.toHaveStyle(
- 'box-shadow: none'
+
+ const { container: withoutBorders } = render(
+ Code is Poetry
);
- rerender( Code is Poetry );
- expect( container.firstChild ).toHaveStyle( 'box-shadow: none' );
+ expect( withBorders ).toMatchDiffSnapshot( withoutBorders );
} );
it( 'should add rounded border when the isRounded prop is true', () => {
diff --git a/packages/components/src/flyout/test/__snapshots__/index.js.snap b/packages/components/src/flyout/test/__snapshots__/index.js.snap
index 9aeeace655ce5e..6c883f1764a9a5 100644
--- a/packages/components/src/flyout/test/__snapshots__/index.js.snap
+++ b/packages/components/src/flyout/test/__snapshots__/index.js.snap
@@ -5,11 +5,21 @@ exports[`props should render correctly 1`] = `
background-color: #fff;
color: #000;
position: relative;
- box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.1);
outline: none;
border-radius: 2px;
}
+.emotion-1::before {
+ content: '';
+ box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.1);
+ position: absolute;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ pointer-events: none;
+}
+
.emotion-1 .components-card-body {
max-height: 80vh;
}