Coder Social home page Coder Social logo

Comments (4)

ajvillegas avatar ajvillegas commented on May 3, 2024 2

I agree with @ZachSaucier, not only do they create bad markup, but some of these components – mainly any using the checkbox or radio hack – are not accessible and make it impossible for keyboard or screen reader users to access the hidden content. This alone is in my opinion, reason enough to not use these components in production. I see that they did add a note to the Readme that explains this, but it should be more clear.

from you-dont-need-javascript.

TheJaredWilcurt avatar TheJaredWilcurt commented on May 3, 2024

I think if you can represent your markup semantically and have your CSS perform the same effect as what JS would do, it's a valid use case. If there are no downsides to the CSS route.

The issue with using CSS in fringe cases is that you have to do more browser testing to verify that it works as expected in a wide variety of browsers.

I think of lists like this one as more of ideas, or seeing how far you can push something. Most of them are not great for production purposes. The carousels can't lazyload images. The games can't save your progress. These CSS only routes have limitations. So if those features it can't do are things you may want in the future, they're not a good idea either.

from you-dont-need-javascript.

ZachSaucier avatar ZachSaucier commented on May 3, 2024

Adding extra input elements is terrible for markup... I maintain an article reading extension that looks for content in pages and most of these techniques would leave unused, unstyled, seemingly random elements in the content I'm obtaining. My project is just one example of how web pages are not always viewed using the venues we plan for.

I agree with your other points. That's why this project and the examples should have a very noticeable disclaimer so that people getting into the field realize that these are not meant for production in most cases.

from you-dont-need-javascript.

Download avatar Download commented on May 3, 2024

I hear mostly theoretical issues with CSS 'hacks'.

Let me give a practical upside: Time-to-Interactive, or how long it takes for a page to load.

The problem with JS is that it has to start running at some point, which can't be too early (or DOM elements will not have parsed yet) but should also not be too late (because it will kill TTI). The best thing would be to run the script for a component right after the content for it has rendered, but that would mean littering your document with inline script fragments. Still, given the choice to litter the document with scripts or making the customer wait longer (and risk him taking his business elsewhere) I'll litter my document with scripts any day.

I have been working on/with this problem for years now and you just can't do it right. Load all scripts at the end of the page (which is what most people advise nowadays) and you risk looooooong TTI if the page has a lot of content. Loading on DOMContentLoaded works cross browser, but is essentially the same; your scripts only start to run when all markup has been parsed. onLoad takes even longer than the aforementioned two. Or you can litter tour document with inline scripts.

Or, just don't rely on scripts for basic functionality unless really needed. CSS-only components neatly bypass all these issues. As soon as a component has rendered it just works. That alone makes them worth investigating.

from you-dont-need-javascript.

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.