Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

storybook 6: zoom buttons in docs do not work #12324

Closed
DanielRuf opened this issue Aug 31, 2020 · 12 comments
Closed

storybook 6: zoom buttons in docs do not work #12324

DanielRuf opened this issue Aug 31, 2020 · 12 comments

Comments

@DanielRuf
Copy link
Contributor

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

@shilman
Copy link
Member

shilman commented Aug 31, 2020

Works in chrome, appears to be broken in FF

@ndelangen
Copy link
Member

Here's the relevant code:

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

@Tomastomaslol
Copy link
Member

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! 🙂

@ndelangen
Copy link
Member

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

@DanielRuf
Copy link
Contributor Author

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.

@Tomastomaslol
Copy link
Member

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.

@DanielRuf
Copy link
Contributor Author

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.

@ndelangen
Copy link
Member

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

@stale
Copy link

stale bot commented Oct 4, 2020

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!

@Tomastomaslol
Copy link
Member

Tomastomaslol commented Oct 21, 2020

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:

#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.

@ndelangen
Copy link
Member

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

@shilman shilman added this to the 6.1 docs milestone Oct 22, 2020
@shilman shilman removed the tracked label Nov 4, 2020
@shilman
Copy link
Member

shilman commented Nov 19, 2020

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.

@shilman shilman closed this as completed Nov 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants