storybook 6: zoom buttons in docs do not work

Created on 31 Aug 2020  路  12Comments  路  Source: storybookjs/storybook

Describe the bug
Clicking the zoom in / out buttons in the docs tab does nothing.

To Reproduce
Steps to reproduce the behavior:

  1. Create a new default sotrybook setup with npx sb init
  2. Start storybook and go to http://localhost:6006/?path=/docs/example-button--primary
  3. Click on the zoom in / out buttons.

Expected behavior
The rendered component should be visible.

Screenshots
grafik

Code snippets

System:

  System:
    OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
    CPU: (8) x64 Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
  Binaries:
    Node: 10.16.0 - ~/.nodenv/versions/10.16.0/bin/node
    Yarn: 1.22.5 - ~/.yvm/shim/yarn
    npm: 6.13.4 - ~/.nodenv/versions/10.16.0/bin/npm
  Browsers:
    Chrome: 81.0.4044.113
    Firefox: 79.0
  npmPackages:
    @storybook/addon-a11y: ^6.0.20 => 6.0.20 
    @storybook/addon-actions: ^6.0.19 => 6.0.20 
    @storybook/addon-console: ^1.2.1 => 1.2.1 
    @storybook/addon-essentials: ^6.0.19 => 6.0.20 
    @storybook/addon-links: ^6.0.20 => 6.0.20 
    @storybook/addon-storysource: ^6.0.20 => 6.0.20 
    @storybook/node-logger: ^6.0.19 => 6.0.20 
    @storybook/preset-create-react-app: ^3.1.4 => 3.1.4 
    @storybook/react: ^6.0.19 => 6.0.20 

Additional context

P1 docs other bug todo

Most helpful comment

It doesn't look like there is any support for zoom in firefox.

https://caniuse.com/#feat=css-zoom

I think it should be enough to replace it with a transform: scale(). I will give go locally and see if it works! 馃檪

All 12 comments

Works in chrome, appears to be broken in FF

It doesn't look like there is any support for zoom in firefox.

https://caniuse.com/#feat=css-zoom

I think it should be enough to replace it with a transform: scale(). I will give go locally and see if it works! 馃檪

It will, but it will mean the scrollbar will scale as well. This is why zoom was used.

It will, but it will mean the scrollbar will scale as well. This is why zoom was used.

The scrollbar of an iframe? Should not be the case when you apply scale only on the rendered component(s). Or maybe I missed something.

The scrollbar of an iframe? Should not be the case when you apply scale only on the rendered component(s). Or maybe I missed something.

Out of interest, I had a quick play around with this and the behaviour of zoom and transform: scale() is quite different.

Using zoom:

zoom

{ zoom = 1 }) => ({
    '> *': {
      zoom: 1 / zoom,
    },

Using transform scale:

transform

  ({ zoom = 1 }) => ({
    '> *': {
      transform: `scale(${1 / zoom})`,
    },
  }),

It's possible that the functionality could be rewritten using transform scale but the effort would greater than a simple one-liner.

Out of interest, I had a quick play around with this and the behaviour of zoom and transform: scale() is quite different.

That is probably because of how it is positioned and some transform-origin issue maybe.

looks like a transform-origin: top left should fix that issue @DanielRuf

Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks!

Hi @ndelangen!

I took another look at this issue and tried to replicate the behaviour of the CSS zoom using transform and scale. I think I managed to create something that is fairly close to the original behaviour:

https://github.com/storybookjs/storybook/pull/12845
firefoxpreview

If you have some spare time please let me know if you think the solution would work and if you would like me to spend some more time testing/tweaking it to try to get a fix merged.

@Tomastomaslol of course I do! https://calendly.com/ndelangen/storybook just pick a date & time 馃憤

ZOMG!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.1.0-rc.6 containing PR #12845 that references this issue. Upgrade today to the @next NPM tag to try it out!

npx sb upgrade --prerelease

Closing this issue. Please re-open if you think there's still more to do.

Was this page helpful?
0 / 5 - 0 ratings