News for hackers. Stuff that matters.
Re:Ask HN: Button UI behaviour by Nadya on Thursday March 08, 2018 @04:58PM (#16548065)
Check the css for `:active` as the button is being styled for `:active` which doesn't care if the Javascript functionality takes place or not. If you debounce the Javascript to prevent the action from firing multiple times that doesn't stop you from clicking the button and setting it to the `:active` state causing the styles to occur.

Codepen example: https://codepen.io/anon/pen/bvGrKY

Click the button as much as you like - after 200 milliseconds you'll get a single alert but the `:active` style always applies on click.

There are no comments on this comment yet.