Giter Club home page Giter Club logo

Comments (6)

nkbt avatar nkbt commented on August 17, 2024 1

Look at this tiny fix: http://codepen.io/nkbt/pen/avRXPZ?editors=001

Adding overflow: hidden to wrapper div, "fixes" it. Like.... Really. That works. But it is an edge case, not a generic solution =(.

This is why I'd prefer to add a section to the README with these cases, examples and possible solutions. I believe it would be better approach.

from react-collapse.

nkbt avatar nkbt commented on August 17, 2024

I prefer to add this into Gotcha section of readme rather then calculate them myself. That would decrease speed. though can be quite easily solved by wrapping either children or Collapse itself.

I can be wrong though, just did not find the case where margins cannot be avoided using Collapse.

from react-collapse.

souporserious avatar souporserious commented on August 17, 2024

Yeah it can be worked around with adding padding to the container, or anything else that gets rid of collapsing margins. Here's an example of how it gets dorked http://codepen.io/souporserious/pen/a060aeb382b647b32deb73346ac9de76/

from react-collapse.

nkbt avatar nkbt commented on August 17, 2024

The problem with margins is that they are "collapsing". Having two elements stick to each other vertically - their margins will overlay. And that works not all the time. They also "leak" outside of elements (in your example H1 margins leak outside of wrapper div). There are some hacks to fix that in place, but I'd avoid trying to fix them "in general". Rather then "polyfilling" conceptually broken css, I'd prefer to add some usage restrictions. Especially considering they are not that ridiculous, just cutting off some edge cases.

from react-collapse.

ingro avatar ingro commented on August 17, 2024

Sorry for commenting on this, but adding a div with overflow:hidden works for the margin issue but doesn't work well with the keepCollapsedContent option. It seems like only the wrapper div is kept, while the children inside are not and throws various errors while interacting with them.

from react-collapse.

nkbt avatar nkbt commented on August 17, 2024

from react-collapse.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.