Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import preview from '../../../../../../.storybook/preview';
import { Zoom } from './zoom';

const openDialog = async (context: StoryContext<typeof Zoom>) => {
const zoom = await context.canvas.findByRole('button', { name: 'Change zoom level' });
const zoom = await context.canvas.findByRole('switch', { name: 'Change zoom level' });
await context.userEvent.click(zoom);
return screen.findByRole('dialog');
};
Expand Down
6 changes: 3 additions & 3 deletions code/core/src/manager/components/preview/tools/zoom.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { PropsWithChildren } from 'react';
import React, { Component, createContext, memo, useCallback, useEffect, useRef } from 'react';

import { ActionList, Button, PopoverProvider } from 'storybook/internal/components';
import { ActionList, PopoverProvider, ToggleButton } from 'storybook/internal/components';
import type { Addon_BaseType } from 'storybook/internal/types';

import { UndoIcon, ZoomIcon } from '@storybook/icons';
Expand All @@ -15,7 +15,7 @@ import { NumericInput } from '../NumericInput';
const ZOOM_LEVELS = [0.25, 0.5, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 2, 3, 4, 8] as const;
const INITIAL_ZOOM_LEVEL = 1;

const ZoomButton = styled(Button)({
const ZoomButton = styled(ToggleButton)({
minWidth: 48,
});

Expand Down Expand Up @@ -148,7 +148,7 @@ export const Zoom = memo<{
padding="small"
variant="ghost"
ariaLabel="Change zoom level"
active={value !== INITIAL_ZOOM_LEVEL}
pressed={value !== INITIAL_ZOOM_LEVEL}
>
{Math.round(value * 100)}%
</ZoomButton>
Expand Down