Storybook: Viewport addon not working as expected

Created on 2 Apr 2019  路  13Comments  路  Source: storybookjs/storybook

Describe the bug
After registering the addon it's icon shows up in the storybook window but the behavior is odd. Whenever I try to chose a viewport I end up with the same thing.

To Reproduce
Steps to reproduce the behavior:

  1. Install the addon yarn add -D @storybook/addon-viewport
  2. Register it in addons.js
import '@storybook/addon-viewport/register';
  1. Create a story:
import React from 'react';
import { storiesOf } from '@storybook/react';

import ActionDialog from './index';

storiesOf('ActionDialog', module).add('default', () => (
  <ActionDialog>Dialog Content</ActionDialog>
));
  1. Run storybook

Expected behavior
The viewport setting resizes the viewport as shown in the print in the Readme.

Actual behavior
With no breakpoints selected (this is correct)
Screenshot from 2019-04-02 18-14-13

With any breakpoint selected (in this case, iphone6)
Screenshot from 2019-04-02 18-14-23

Notice that it changes the size of the viewport (see scrollbar on the right) but not to the expected size.

System:

  • OS: Ubuntu 16.04
  • Device: Desktop
  • Browser: chrome
  • Framework: react
  • Addons: breakpoint
  • Version: 5.0.6
viewport bug high priority

Most helpful comment

Guys, I apologize: it's my mistake, I fixed zoom and broke background addon.
I create PR to fix my past mistakes. 馃敐

All 13 comments

Have you taken a look at our example? Does this work as expected on your machine/browser?

https://storybooks-official.netlify.com/?path=/story/ui-panel--default

Yes it does. I cloned the repo and will test the example to see if I find any difference between my setup and what the example does.

@shilman, I'm definitely seeing an issue similar to this in next. Example can be found here: https://next--storybooks-vue.netlify.com/?path=/story/welcome--welcome
image

It looks like this is a problem in next but not master. Perhaps it was introduced in https://github.com/storybooks/storybook/pull/6045

@lucas-carl mind taking a look at this?

@shilman I looked into the _next_ version right after my PR but can't seem to find any bugs.

Having the same issue.

Seeing this issue with @next

Same here, broken on @next

@lucas-carl Indeed, I checked and the problem got introduced in alpha.15, probably by this PR: https://github.com/storybooks/storybook/pull/6126

@Armanio mind looking into this?

I'll check it today. Give me a few hours. 馃憤

Guys, I apologize: it's my mistake, I fixed zoom and broke background addon.
I create PR to fix my past mistakes. 馃敐

Just tested and it is working just fine. Thank you guys :)

w00t!! I just released https://github.com/storybooks/storybook/releases/tag/v5.1.0-alpha.26 containing PR #6502 that references this issue. Upgrade today to try it out!

Because it's a pre-release you can find it on the @next NPM tag.

Was this page helpful?
0 / 5 - 0 ratings