w3c / uievents

UI Events
https://w3c.github.io/uievents/
Other
145 stars 51 forks source link

"UI Actions" or Event Responses for Simplified UI Scripting #295

Open excitedbox opened 3 years ago

excitedbox commented 3 years ago

UI events are defined in the HTML spec, used to call JS functions, to implement CSS changes.

The lack of Simple UI actions means that even static websites require complicated JS just like a dynamic website. Eliminating a lot of the benefits of a static website.

I believe there needs to be an expansion to the CSS/HTML/DOM spec to allow for easier UI scripting. This expansion would be used solely for implementing user interface actions or the responses to events.

Something like a dynamic event handler that is easily defined/scriptable to do things such as modifying CSS styles, iterating through data arrays, updating the DOM, and acting on UI events (clicks, drags, form changes etc.)

Right now for each and every UI load, change, click you need to write a JS function even when all you need to do is add or remove a style. This is not only difficult for beginners but very inefficient and extra work and repetition for developers. Js is also very verbose and using standard JS inline even for adding a style would make a mess of code.

Some attempts at solving this have been made with frameworks such as AlpineJS and VueJS which use a small set of JS functions to cover many of the use cases but they are limited by hacks and workarounds that work with the HTML spec. (ie.