-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Transform properties aren't removed from hidden grid items and that causes a fixed positioning issue. #1593
Comments
Could you perhaps explain your use case here, and even maybe do a CodePen for what you're trying to accomplish? I may be misunderstanding you, but I suppose I fail to see the intent here. If add hidden as you explained on the Isotope docs page, you're right, the items do not get re-calculated. That said, when I add the attribute the grid will be hidden by the browser since So, it seems that if you wanted the grid to still show up even with Like I said, I may have misunderstood you, and if so, please clarify. |
The When browser resizes, grid items in a hidden tab panel are re-layouted, but their CSS transform properties aren't removed. And after a hidden tab panel is unhided, the fixed positioning issue emerges. |
I would really need a more specific example/codepen at this point. That said, I think the best solution to your situation is realistically changing the way you're using/styling the tabs. Per the HTML spec the
There are several other ways using that you could achieve the same layout with CSS/JS or some combo. That would eliminate the problem completely as it would take hidden out of the equation. |
@thesublimeobject Specific example. I'll check with W3 about the spec of |
Thanks for the example!
Honestly, I don't think it should be working; that has sort of been my point this whole time. When playing with this example, in order to be sure I was thinking through this correctly, I wrote a small function to output the styles of the tabpanel, grid, and one of the grid items. When the tabpanel is hidden, all of those items are essentially stripped of their style props since they are no longer marked necessary for render. So all of their widths/heights/etc. are just Therefore, when resizing the window while one of the layouts is hidden, Isotope cannot calculate the element styles since the browser is literally not bothering to render where they would be. It's not that those elements are just "not displayed", they are simply not rendered at all by the browser. So when you switch back to the layout that was hidden, it doesn't have any way to calculate the current element sizes unless you manually trigger some other event. I'm still not completely sure why it matters if the transform properties themselves are on there or not. As far as I can tell it's just retaining the values from before since that is likely the only values it has to process. If you want to keep this Does that make sense? |
Well, my previous message wasn't stating the re-layout issue clearly. Sorry about that. Actually, the re-layout does not happen in a hidden tabpanel. Instead, a hidden tabpanel is temporarily unhided for the re-layout. And then the tabpanel is hidden again after the re-layout is done. I just compared my real use case with the example I created here and figured out why exactly the re-layout didn't work in this example. It has been fixed. Now the only issue is that the CSS transform properties aren't removed. As for the |
@ianthedev — I read some of the comments linked above, but I think I'm still in the camp that it would likely be better to just not use the With regard to the updated Pen, I do see that the re-layout works correctly now. I guess I'm still a bit unclear on why it matters that the Your original post says,
In which cases would this be undesirable? Are you saying that you have Nonetheless, you could potentially just attach a |
Thanks for the advice. That can be a provisional workaround. |
@ianthedev — Per your other thread, you said that this issue isn't "solved" yet because you only consider this a provisional workaround. That said, I would personally consider this issue solved since I'm not entirely convinced this is actually a bug so much as an esoteric issue, which may or may not stem from the incorrect use of tabs with the @desandro — Would you mind confirming my intuition here? Or if you disagree, I can perhaps look into a fix for it, although as it stands I'm not really convinced that this is truly a bug. |
|
@ianthedev, from my response above —
While you did say the solution that I gave below these quotes from the above response would work as a provisional workaround, you never really detailed why this would be an issue, or why and in which case this sort of setup would be undesirable. So even beyond the |
Let's forget it for now then. |
If the grid items or any of their parent elements have the
hidden
attribute and become hidden, then after a re-layout, the CSS transform properties won't be removed from grid items.And after the
hidden
attribute is removed, the CSS transform properties remain exist. And that causes a fixed positioning issue that the grid items becomes the containing block of any fixed-positioned child element, and that is undesirable in most cases. Please see MDN's explanation about how the containing block is determined in fixed positioning.You can reproduce the transform properties' not being removed from grid items by using the official horrizontalOrder demo:
hidden
attribute on the grid container, and then observe the CSS transform properties' not being removed from the grid items after a re-layout followed by a browser resizing.The text was updated successfully, but these errors were encountered: