3 ms·
Super superficial (?), but the "press and hold" example on https://hyperscript.org/ https://hyperscript.org/ has a bug (feature? :) in that if you move away the
by pflanze 4y ago
Super superficial (?), but the "press and hold" example on https://hyperscript.org/ https://hyperscript.org/ has a bug (feature? :) in that if you move away the pointer while pressing, then let go, it keeps cycling, and won't stop even if you go back and press and let go again. It will stop if you press outside the button and let go inside, so apparently the actions stack. (On Firefox Linux.)
- animal_spirits 4y ago"Nitpicky" I think is the word you are looking for
- pflanze 4y agoI found it interesting behavior and it might be important in the larger picture, thus I'm not sure it's superficial, that's why I put the question mark there. Of course I don't mean that this should take away from the appreciation of the language. I'd have made a bug ticket instead if it weren't just much simpler to mention here, also this way I'm not implying that I'm a user and waiting for a resolution.
- recursivedoubts 4y agogood find the code should be updated to: <button _="on pointerdown repeat until event stopCycling set rand to Math.random() * 255 transition *background-color to `hsl($rand 100% 90%)` over 250ms end on pointerup or mouseleave trigger stopCycling"> Click And Hold Me </button> to capture both the pointerup and mouseleave events (seems like some browsers trigger the pointerup event even if the mouse/pointer has left the element) unfortunately right now the `repeat until event` form doesn't take multiple events, so we have to kick out to another event handler to capture both. I'll try to fix that in the next release.