-
Notifications
You must be signed in to change notification settings - Fork 841
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
EuiAccordion initialIsOpen doesn't work correctly #805
Comments
Jumping on this. |
this is still happening with latest EUI version |
the problem is probably the fact that the accordion is inside a div with display:none ... why don't we leave height to auto if accordion is not collapsed, and only set it when user clicks the collapse button (in order to animate it). |
Why are you putting it inside a div with display none? Use visibility: hidden instead? |
as div with visibility hidden will still occupy its space ? also not sure it will behave correctly with flex display ? (which is used in this part ... i tried just replacing display: none with visibility: hidden and everything is broken ... ) its angular legacy code (ng-show, ng-if) |
@snide I think that using the accordion in that kind of situation should still work, since a component inside a UI framework should assume as less as possible around it's context it's used in. I think we could write that component in a way, that it would still work in those scenarios by not calculating the size initially on |
@timroes That sounds fine if you want to set up a PR, we can help review. |
So I looked deeply into this issue and I don't think there is anything we can do on our side to fix this. The problem in your situation is that when the component mounts (and initially it mounts, then updates twice, not sure why), it is initially hidden from the DOM leaving it with no height to calculate. Ok, fine, no big deal, we'll just wait for it to get un-hidden. The problem with that, is when you change tabs, there is no event fired back at the component to update. You will need to somehow force it do so. Updating components in react will only happen if you change the props or state, and you're doing neither in this case. This may not be anything new to any of you, but it's good to jot down what is exactly going on and why it's dependent on implementation and not the component itself. |
I'm reclosing this. Right now I consider this an implementation problem in Kibana rather than a problem with the component itself. If an engineer has a better way to handle this that makes it more flexible please submit a PR and we can help review. |
Hey @cchaos, thanks a lot for digging so deep into this! We'll look for a way to properly work around this for now. In the new editor that shouldn't be an issue at all, since we won't have any Angular frame around it and can use an aligned state management in the hole editor! |
Seems that when the element is not visible initially and
initialIsOpen
is set totrue
, height is incorrectly calculated and set to 0px? This prevents using anEuiAccordion
in any form of tabs right now.this is my PR where its going wrong: elastic/kibana#18579
The text was updated successfully, but these errors were encountered: