diff --git a/code/addons/viewport/src/Tool.tsx b/code/addons/viewport/src/Tool.tsx index bb7f5f0b81e0..615878d2cc28 100644 --- a/code/addons/viewport/src/Tool.tsx +++ b/code/addons/viewport/src/Tool.tsx @@ -155,9 +155,9 @@ export const ViewportTool: FC = memo( setState({ selected: defaultViewport || (viewports[state.selected] ? state.selected : responsiveViewport.id), - isRotated: state.isRotated, + isRotated: defaultOrientation === 'landscape', }); - }, [defaultViewport]); + }, [defaultOrientation, defaultViewport]); const { selected, isRotated } = state; const item = diff --git a/code/addons/viewport/template/stories/parameters.stories.ts b/code/addons/viewport/template/stories/parameters.stories.ts index 8ea3a1bbc4dc..4aba0bd2970a 100644 --- a/code/addons/viewport/template/stories/parameters.stories.ts +++ b/code/addons/viewport/template/stories/parameters.stories.ts @@ -26,6 +26,15 @@ export const Selected = { }, }; +export const Orientation = { + parameters: { + viewport: { + defaultViewport: Object.keys(MINIMAL_VIEWPORTS)[0], + defaultOrientation: 'landscape', + }, + }, +}; + export const Custom = { parameters: { viewport: {