Baby steps with StimulusJS

Last night I needed a much needed break from the usual Rails coding, so I worked through an example on the StimulusJS website so that I could add a “copy to clipboard” button for the displayed writing prompt on Writeabout.

For me, this is the ideal level of integration I need with JavaScript. A framework that does some of the heavy lifting on the user-interface without me having to re-write the whole front-end.

The end result is nice, but I don’t like the way the elements on the page move up and down when the copy button has been pressed. I’ve added a little div section with an indicator that the button has been pressed. It disappears after a few seconds, but it moves the elements on the page up and down when it changes its display state. I’ll fix it another day, but the first pass at this functionality is still good.