-
Notifications
You must be signed in to change notification settings - Fork 82
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
fix: display none has negative impact on svgs used inside a collapse #2311
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🦋 Changeset detectedLatest commit: 69c2498 The changes in this PR will be included in the next version bump. This PR includes changesets to release 33 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
size-limit report 📦
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this could break use of useEffect
in children components 🤔 Any idea?
Do you have a reproduction of this I can try? |
@denkristoffer here is a super quick codepen: https://codepen.io/Lelith/pen/rNKxJBG I would not see why it would have a side effect for useEffect, as the css change is still programmatically via the toggle, only with different content. So a rerender is clearly forced. |
I figured the switch might affect the DOM but it seems to be fine. |
Not sure what's going on with Chromatic, let me try rerunning CI from scratch. |
@denkristoffer i saw that too, and locally it got fixed once i rebuilt the packages. it seems to be stuck in a inbetween state, like updating the css rules but not the javascript (or vice versa?) |
so i tried it in our app, but it breaks the behaviour of the dragable again, so will close it |
Purpose of PR
This is a side-effect fix.
I have multiple collapsable containers using this collapse animation. Inside of these containers i have a colorful svg icon with a gradient in several of them.
Every time the first container that has the icon gets collapsed, the gradient disappears. This is a known chromium bug since almost 10 years now The issue exists not only in chrome but also in firefox (it was also in webkit, but safari fixed it at some point)
What happens is, that the reference all of the svg files have to the gradient (via id) always points to its first defintion. When this first svg is now set to display:none this defintion stops to exist for all following instances of the same svg in the page.
The simplest to achieve fix is: do not use display:none but visibility:hidden to hide the content.
If there are no objections or other reasons why display:none is the important rule, please let me know and we can think about other solutions.
Maybe its also worth checking again the proposal here #2043