Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Web components are okay as long as you only use them to progressively wrap actual HTML elements. If you're using custom-elements by themselves like a JS frontend replacement and just making entire web pages full of blank grey boxes that do nothing without JS, you're doing a bad job.

See: https://blog.jim-nielsen.com/2023/html-web-components/



Oh? So anyone writing applications, PWAs, healthcare software, responsive mobile web apps, or a billion other business domains where the web makes sense as a UI is doing a bad job?

Guess I've been doing a bad job for a long time now.


Yes, https://www.gov.uk/service-manual/technology/using-progressi...

“All [UK] government services must follow progressive enhancement, even if part of the service or a parent service needs JavaScript”

But more seriously, it's okay to do a bad job if you're being paid/forced to do it by a for-profit entity. That's what jobs are. Being paid to do things you wouldn't do otherwise (like making a webpage entirely inaccessible to people with screen readers because there's no text in the custom-elements pre-JS execution and not caring because the visually impaired don't contribute significantly to profit). Just don't chose to do a bad job for personal stuff.


While that link is great advice it's not 100% true that you need to have JS enabled to render anything in a web component - there's declarative shadow dom. Also while it's also true to depend on as little as possible JavaScript it's also required for some accessibility aspects. You can get far with only HTML and CSS but not always all the way.


Screen readers that can't do their job on dynamically generated pages are faulty and should not be relied upon by anyone, especially for browsing the web. There is absolutely no reason to be beholden to the incompetence of the developers of such software.


Yeah, those visually impaired people should be constantly changing their screen reader software so as to follow the eternally changing wave of web dev. That's totally a feasible and reasonable thing to ask. I'm sure the shadow dom is giving those dynamic screen readers zero problems. /s

Please, please just consider putting actual text in the HTML. It helps a lot.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: