5 ms·
Thanks for sharing The idea of declarative UI actions without JS is appealing The good: * Killing boilerplate for popovers/modals (no more aria-expanded jugg
by Starlord2048 2y ago
Thanks for sharing
The idea of declarative UI actions without JS is appealing
The good:
* Killing boilerplate for popovers/modals (no more aria-expanded juggling).
* Built-in commands like show-modal bake accessibility into markup.
* Custom commands (e.g., --rotate-landscape) let components expose APIs via HTML.
My doubts:
* Abstraction vs. magic: Is this just shifting complexity from JS to HTML? Frameworks already abstract state—how does this coexist?
* Shadow DOM friction: Needing JS to set .commandForElement across shadow roots feels like a half-solved problem.
* Future-proofing: If OpenUI adds 20+ commands (e.g., show-picker, toggle-details), will this bloat the platform with niche syntax?
- SamBam 2y ago> Abstraction vs. magic: Is this just shifting complexity from JS to HTML? Frameworks already abstract state—how does this coexist? The same way React or other frameworks can hook into things like CSS animations. If CSS animations didn't exist, the JS framework would have to write all the code themselves. With them existing, they can just set the properties and have it work. Even if you're writing a basic menu popup directly in React, having these properties to use directly in your JSX means less code and less room for error. Then if you need to do something special, you may need to do it by hand and not use these properties, just like if you needed a special animation you might have to do it without using the CSS animation properties.
- fitsumbelay 2y agoagreed, my sense is that frameworks will update to take advantage as they've done in the past
- toomim 2y ago> Is this just shifting complexity from JS to HTML? Very well said. This is the problem. There's an old adage that every "scripting" language starts out small, but then ultimately needs all the features of a full programming language. If we start putting programming features into HTML, we'll eventually turn it into a full turing-complete programming language, with loops, conditionals, variables, and function calls. We'll have recreated javascript, outside of javascript.
- satvikpendem 2y agoCSS is now getting functions as well [0]. [0] https://news.ycombinator.com/item?id=43236126 https://news.ycombinator.com/item?id=43236126
- toomim 2y agoHorrible. We're going to end up with three separate languages: CSS, HTML, and Javascript, which will each be turing-complete programming languages with completely-overlapping featuresets, and there will be no clear reason to use one over the other. Browsers will have to implement support for three PL runtimes. Everything will be complicated and confused.
- xg15 2y agoEverything will be even more complicated and confused.
- someothherguyy 2y agoThe sky isn't falling, and nearly everything is trending better, not worse. You can use whatever features of browsers that you want.
- metadat 2y agoThere are tradeoffs. Further increasing the barrier to entry for new web browsers benefits the entrenched players and hurts end users by yielding fewer alternatives.
- porridgeraisin 2y agoThe entrenched are the ones deciding the features. This is their goal
- agosz 2y agoThat's what people say of C++ too. Too many features makes it harder to learn a language and ramp up on codebases; they'll have different standards on what they use.
- tomrod 2y agoI'm not a web dev, so I apologize if my questions are naive. Does this mean its a chrome-only thing or does it become a web standard? I ask because I would like to imagine the future isn't tied to Google's whims, graveyard of initiatives, and requirements.
- freeone3000 2y agoThat would be really nice, but, that’s been the way of it for the last few features too… it might not get adopted, but if enough people start using it…
- chuckadams 2y agoIt's already implemented in bleeding edge builds of Firefox and Safari, just behind a feature flag (as it also is in chrome) https://caniuse.com/mdn-api_commandevent https://caniuse.com/mdn-api_commandevent
- brap 2y agoMy experience with anything declarative is that features are gradually bolted on until it eventually just becomes imperative (and ugly). For example HCL. I believe declarative should stay purely declarative to describe data/documents in a static state (e.g. HTML, JSON) and an imperative “layer” can be used to generate or regenerate it, if needed.