diff --git a/code/e2e-tests/addon-viewport.spec.ts b/code/e2e-tests/addon-viewport.spec.ts
index da66778a3708..ec96a3bd93ea 100644
--- a/code/e2e-tests/addon-viewport.spec.ts
+++ b/code/e2e-tests/addon-viewport.spec.ts
@@ -28,13 +28,13 @@ test.describe('addon-viewport', () => {
await sbPage.navigateToStory('example/button', 'primary');
// Measure the original dimensions of previewRoot
- const originalDimensions = await sbPage.previewRoot().boundingBox();
+ const originalDimensions = await sbPage.getCanvasBodyElement().boundingBox();
await expect(originalDimensions?.width).toBeDefined();
await sbPage.selectToolbar('[title="Change the size of the preview"]', '#list-item-mobile1');
// Measure the adjusted dimensions of previewRoot after clicking the mobile item.
- const adjustedDimensions = await sbPage.previewRoot().boundingBox();
+ const adjustedDimensions = await sbPage.getCanvasBodyElement().boundingBox();
await expect(adjustedDimensions?.width).toBeDefined();
// Compare the two widths
diff --git a/code/renderers/react/template/stories/ts-argtypes.stories.tsx b/code/renderers/react/template/stories/ts-argtypes.stories.tsx
index 21eb492d30e7..f2b29752c276 100644
--- a/code/renderers/react/template/stories/ts-argtypes.stories.tsx
+++ b/code/renderers/react/template/stories/ts-argtypes.stories.tsx
@@ -1,10 +1,12 @@
import React, { useState } from 'react';
import mapValues from 'lodash/mapValues.js';
import { PureArgsTable as ArgsTable } from '@storybook/blocks';
+import type { StoryObj } from '@storybook/react';
import type { Args, Parameters, StoryContext } from '@storybook/types';
import { inferControls } from '@storybook/preview-api';
import { ThemeProvider, themes, convert } from '@storybook/theming';
+import { within } from '@storybook/testing-library';
import { component as TsFunctionComponentComponent } from './docgen-components/ts-function-component/input';
import { component as TsFunctionComponentInlineDefaultsComponent } from './docgen-components/ts-function-component-inline-defaults/input';
import { component as TsReactFcGenericsComponent } from './docgen-components/8143-ts-react-fc-generics/input';
@@ -76,6 +78,27 @@ export const TsComponentProps = { parameters: { component: TsComponentPropsCompo
export const TsJsdoc = { parameters: { component: TsJsdocComponent } };
-export const TsTypes = { parameters: { component: TsTypesComponent } };
+const addChromaticIgnore = async (element: HTMLElement) => {
+ const row = element.parentElement?.parentElement;
+ if (row?.nodeName === 'TR') {
+ row.setAttribute('data-chromatic', 'ignore');
+ } else {
+ throw new Error('the DOM structure changed, please update this test');
+ }
+};
+
+export const TsTypes: StoryObj = {
+ parameters: { component: TsTypesComponent },
+ play: async ({ canvasElement }) => {
+ // This play function's sole purpose is to add a "chromatic ignore" region to flaky rows.
+ const canvas = within(canvasElement);
+ const funcCell = await canvas.findByText('funcWithArgsAndReturns');
+ addChromaticIgnore(funcCell);
+ const namedNumericCell = await canvas.findByText('namedNumericLiteralUnion');
+ addChromaticIgnore(namedNumericCell);
+ const inlinedNumericCell = await canvas.findByText('inlinedNumericLiteralUnion');
+ addChromaticIgnore(inlinedNumericCell);
+ },
+};
export const TsHtml = { parameters: { component: TsHtmlComponent } };
diff --git a/code/ui/.storybook/preview.tsx b/code/ui/.storybook/preview.tsx
index ed08e0fd9886..7c52ad023776 100644
--- a/code/ui/.storybook/preview.tsx
+++ b/code/ui/.storybook/preview.tsx
@@ -64,18 +64,19 @@ const ThemeStack = styled.div(
const PlayFnNotice = styled.div(
{
position: 'absolute',
- bottom: '1rem',
- right: '1rem',
- border: '1px solid #ccc',
- borderRadius: '5px',
- padding: '1rem',
- fontSize: '12px',
+ top: 0,
+ left: 0,
+ width: '100%',
+ borderBottom: '1px solid #ccc',
+ padding: '3px 8px',
+ fontSize: '10px',
+ fontWeight: 'bold',
'> *': {
display: 'block',
},
},
({ theme }) => ({
- background: theme.background.content,
+ background: '#fffbd9',
color: theme.color.defaultText,
})
);
@@ -219,10 +220,15 @@ export const decorators = [