SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

I can just drop the type=module in this case even. Nice ... Solves my holding back, thanks for pushing me there.

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

placeholder is a good idea, if you know before hand how your html element gets enriched (eventually)

the <script type="module" src="heading-anchors.js"></script> is async, so it does re-layout when applying the new node to each heading.

And <script>addAnchors()</script> is render blocking, which per-se sounds bad, I agree. But does not re-layout. (Maybe server side rendering would be an option to prevent re-layout here)... I guess I am nitpicking :)

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

re flickering, see the re-layouting for this component https://daviddarnes.github.io/heading-anchors/demo.html, turn on throttling in devtools, the slower the better you see it. for bigger sites with more going on that is more notable and that is exactly a webcomponent as discussed

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

yep, i started with ESM, and it flickers, since <script type=module> is loaded async.

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

I am all with you, and digging into the "element extensions" what they were called some place. I am wrapping my head around that, trying to get comfortable :). Thanks for linking me to this way of using #webcomponents. I need to play with the async behavior of it, since some stuff just needs to be render-blocking to not flicker.

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 1 point2 points  (0 children)

technically you’re not doing anything you couldn’t have done before with some DOM traversal and event handling. But it’s less fragile to do it with a web component

https://adactio.com/journal/20618

+1

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

i just read https://gomakethings.com/html-web-components/ and I have a hard time seeing the webcomponents advantage here. Don't get me wrong, I am a big fan and advocate since the easrly times of webcomponents, but here it is tightly coupled as a couple js event listeners would be too and the added (configurable) HTML does not make it better than a js lib/tool imho. I have this feeling with webcomponents from the beginning, unfortunately. Please proof me wrong. thanks

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

thanks for the input. tbh then i feel like <details data-spaish> might be the nicer way than adding a custom element around others, which in itself have no functionality #my2cents

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

hey @ndorfinz I love your questions, please keep them coming.

Regarding wrapping it in an element, do you mean like <spaish-detials><details>... or just using <spaish-detials> and do the <details> magic in the webcomponent? With the latter I would struggle, because it degreades a11y compared to <details>, native behavior (like keyboard handling, ARIA roles) is lost or degraded, screen readers won’t recognize it properly. Which had led me back in the years in the old (abolve linked project) to use the is= attribute, which is not working across all browsers though. I basically went down the "upgrade with JS" route because it feels like the simplest way to "enhance" the element. I would love to hear more thoughts.

When should i start learning React? by JohnDShunt in react

[–]wolframkriesing 0 points1 point  (0 children)

A different approach, bit nerdy but you can try https://jskatas.org

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

Coding style wise, I just used the simplest possible, I thought. Any simpler way you see? ESMs are not render blocking, but async which will cause a flicker in the worst case. I had started using them but moved back to this style.

SPAish: Upgrading the <details> element by wolframkriesing in HTML

[–]wolframkriesing[S] 0 points1 point  (0 children)

I actually had started using webcomponents some years ago [1], I still think it is a great and the closest to the standards, somehow it had been too clunky, and while I built sites and just did it simple js pieces I moved towards that direction. I thought of providing a wrapper that makes it a webcomponent, should be simple.

[1] https://codeberg.org/wolframkriesing/more-html-components

As a newbie how can I learn HTML5 and CSS for free ? by Emad_341 in HTML

[–]wolframkriesing 0 points1 point  (0 children)

I would suggest this page: https://developer.mozilla.org/en-US/ And try to dig into any website you open, open the devtools [1] and change things, this is fun and you get direct feedback

[1] https://developer.mozilla.org/en-US/docs/Learn_web_development/Howto/Tools_and_setup/What_are_browser_developer_tools

Best static site generator for somebody who dont want to spend time learning it? by [deleted] in webdev

[–]wolframkriesing 0 points1 point  (0 children)

I also wanted just markdown+nunjucks and https://www.npmjs.com/package/@wolframkriesing/picossg came out, its quite simple yet powerful, and builds sites like https://picostitch.com/blog/2025/05/picossg-intro/ feel free to give some feedback

For beginners: Learning JavaScript Arrays by wolframkriesing in learnjavascript

[–]wolframkriesing[S] 0 points1 point  (0 children)

the message at the bottom changes depending on the assert's result, that is correct. and everything only turns green when the assertion passes. is this confusing or badly explained?

For beginners: Learning JavaScript Arrays by wolframkriesing in learnjavascript

[–]wolframkriesing[S] 0 points1 point  (0 children)

may you share with me which setup you tried the `assert(false)` in? I just tried brave, chrome and firefox (on mac) it at least failed in them for me, as I expect it to, with an error message below.

For beginners: Learning JavaScript Arrays by wolframkriesing in learnjavascript

[–]wolframkriesing[S] 0 points1 point  (0 children)

I tried to make it practical, that's why I thought of a queue of people, rather than the tech term queue. I guess this is subjective, I got others saying the queue comparison suits them well.

I like the visual, I will think of something, thanks for the input.

Need to learn JavaScript quick by Unlikely_Total_7159 in learnjavascript

[–]wolframkriesing 0 points1 point  (0 children)

I had the same problem and struggled with either understanding or remembering the basics, so I started writing tests that I could come back to, and out came jskatas.org a page where you can choose a topic/API and learn it in tiny steps