question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Firefox zoom implementation breaks position: fixed elements in Docs

See original GitHub issue

Describe the bug In Firefox, the zoom feature uses transform styles (see https://github.com/storybookjs/storybook/pull/12845) - unfortunately this breaks positioning on elements that require position: fixed when in the “Docs” view.

Normally a position: fixed element’s position would correspond to the viewport but in Firefox it corresponds to the element with the transform style.

The issue is present regardless of actually using the zoom feature. I have tried to disable the zoom feature (related feature request: https://github.com/storybookjs/storybook/issues/16771) in the hopes that it might also remove the styling used for zoom, however, the styling remains.

To Reproduce I created a simplified reproduction of the issue here: https://github.com/idesigncode/bug-storybook-firefox-position-fixed

To view the issue, open the story in Docs view in both Firefox and another browser.

System System: OS: macOS 12.0.1 CPU: (8) x64 Intel® Core™ i7-7820HQ CPU @ 2.90GHz Binaries: Node: 14.17.3 - ~/.nvm/versions/node/v14.17.3/bin/node Yarn: 3.1.0 - /usr/local/bin/yarn npm: 7.20.0 - ~/.nvm/versions/node/v14.17.3/bin/npm Browsers: Chrome: 96.0.4664.55 Edge: 95.0.1020.53 Firefox: 94.0.1 Safari: 15.1 npmPackages: @storybook/addon-actions: ^6.4.0-rc.7 => 6.4.0-rc.7 @storybook/addon-docs: ^6.4.0-rc.7 => 6.4.0-rc.7 @storybook/addon-essentials: ^6.4.0-rc.7 => 6.4.0-rc.7 @storybook/addon-links: ^6.4.0-rc.7 => 6.4.0-rc.7 @storybook/react: ^6.4.0-rc.7 => 6.4.0-rc.7

Additional context My actual use case is documenting a tooltip component that uses fixed positioning to stay within the window.

Here’s some screenshots of the simplified example:

ChromeChrome

FirefoxFirefox

Firefox (with the transform style disabled)Firefox (with the transform style disabled)

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:21 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
idesigncodecommented, Mar 5, 2022

I do not expect there is an ideal fix here as the inconsistency lies in the browsers’ implementation of the transform style…

But if I may propose an alternative: only apply the transform style if the zoom feature is not disabled.

I believe the zoom feature is the only reason to use the transform style in the first place, so applying it while this feature is disabled seems unnecessary.

1reaction
Stroudnatcommented, Jan 27, 2022

Thanks @idesigncode just got around to cloning everything and looking at issue repos so Ill check back if I see anything!

Read more comments on GitHub >

github_iconTop Results From Across the Web

zoom - CSS: Cascading Style Sheets - MDN Web Docs
The non-standard zoom CSS property can be used to control the magnification level of an element. transform: scale() should be used instead ...
Read more >
(csszoom) Implement Internet Explorer zoom property for css
The bug is an easy fix and it is a site mistake. You did a correct analysis. They probably do not need to...
Read more >
Chrome incompatibilities - Mozilla - MDN Web Docs
In Firefox: The zoom level persists across page loads and navigation within the tab. In Chrome: Zoom changes are reset on navigation; navigating ......
Read more >
Handling common accessibility problems - MDN Web Docs
Use the correct semantic elements to mark up different content in HTML; if you want to create a different visual effect, use CSS...
Read more >
transform - CSS: Cascading Style Sheets - MDN Web Docs
The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found