GithubHelp home page GithubHelp logo

Comments (6)

alice avatar alice commented on July 2, 2024

Doesn't that cause the layout objects to be destroyed?

from inert.

chrishtr avatar chrishtr commented on July 2, 2024

No. content-visibility: hidden preserves the layout objects (or more precisely, defines the elements to still have layout boxes. It's technically up to the UA whether to cache the layout objects). In this respect it's like visibility: hidden.

For this reason, content-visibility: hidden is my recommended best practice for hiding DOM that is not part of the current view but might be in the future, for use cases such as caching SPA navigation routes and temporarily hidden drawer widgets. I also recommend it for layout measurement of offscreen content.

from inert.

alice avatar alice commented on July 2, 2024

Ok, what does this mean for inert?

from inert.

chrishtr avatar chrishtr commented on July 2, 2024

I think the other use case - On-screen but non-interactive content is still unmet, and would be a use case of the inert keyword.

from inert.

bkardell avatar bkardell commented on July 2, 2024

For this reason, content-visibility: hidden is my recommended best practice for hiding DOM that is not part of the current view but might be in the future, for use cases such as caching SPA navigation routes and temporarily hidden drawer widgets

I'm having trouble imagining solving some of the desires in the explainer like this, but that's probably just failure of imagination on my part since you specifically even mention drawers here... Any chance you could share implementations of some of these so that we could look/compare?

from inert.

chrishtr avatar chrishtr commented on July 2, 2024

Any chance you could share implementations of some of these so that we could look/compare?

I don't have a specific implementation fo a drawer using content-visibility:hidden on hand to point to. But the implementation would be something like:

drawer[closed] {
  width: 0;
  height: 0;
  content-visibility: hidden;
}
<drawer closed>
 contents
</drawer>

from inert.

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.