| ▲ | bloak 2 hours ago | ||||||||||||||||
I used to have a device with a physical button which, when you pressed it, would beep and add 30 seconds to the time. However, sometimes it would beep and not add 30 seconds, and sometimes it would add 30 seconds without beeping, so you always had to squint at the dim display to discover whether it had worked or not. I thought this must be a peculiarly bad design ... but since then I have lost count of the number of purely software buttons that somehow seem to replicate this broken behaviour: whether the button changes colour on the screen is somehow only loosely correlated with whether the action requested will take place. Why? How, even, have they implemented this? | |||||||||||||||||
| ▲ | csande17 2 hours ago | parent | next [-] | ||||||||||||||||
> Why? How, even, have they implemented this? This is really common because of two design features that most UI frameworks share: - The code that changes the color of the button is an internal part of the "button" component, so that people don't have to individually implement it on every button. But this means that it's kind of disconnected from the code that actually performs the action. If the "on click" handler has some last-ditch check that aborts the action, like the "don't rotate the image if it's in the middle of the rotate animation" check from the article, often there's no way for it to tell the button to cancel the color change. (And conversely sometimes the "on click" handler can fire even if the color change animation doesn't play correctly.) - Buttons usually change color when you press down the mouse button, but only perform the action when you release the mouse button. Sometimes this is used to intentionally give you a chance to cancel the action at the very last minute by dragging your mouse off the button while it's still held down (or, on mobile, to e.g. reinterpret your interaction as scrolling instead of clicking), other times it just creates more opportunities for something to happen that prevents the action from working after the color change has already happened. | |||||||||||||||||
| |||||||||||||||||
| ▲ | tgsovlerkhgsel 26 minutes ago | parent | prev | next [-] | ||||||||||||||||
I notice this pretty consistently with elevators: If you press the button for a short amount of time, it visibly lights up while pressed but doesn't actually register the button-press. | |||||||||||||||||
| ▲ | markatto 39 minutes ago | parent | prev | next [-] | ||||||||||||||||
This is sometimes done intentionally to hide latency and make a UI feel faster - I certainly don’t like it though. | |||||||||||||||||
| ▲ | simonklitj 2 hours ago | parent | prev | next [-] | ||||||||||||||||
I suppose a lack of testing and an assumption that the action will fail so rarely that it’s not worth accounting for? But yes, such patterns make it hard to trust and efficiently use an interface. | |||||||||||||||||
| ▲ | atoav an hour ago | parent | prev [-] | ||||||||||||||||
Bad programming. People who have experience with embedded programming knows that reading out a button usually means denouncing. At the speed a microcontroller can read out a button it will change it's state multiple times per press because of contact bounce. Meaning when a user presses a button the program sees off, on, off, off, on, on, off, on, on, on, on, on, on, etc. Now if you just naively read out the current state of the button and do something with it elsewhere in the program looping may be off or on randomly. It is not hard to imagine if there is some other logic (or e.g. a rate limit) on the 30 seconds and on the beep that these would see different slices in time of the button. Congrats you built a button-debounce based RNG. Physical buttons can be surprisingly complex if you don't rely on someone else's driver. The correct solution is to debounce the button, that can be done either in hardware (too expensive, so rarely done) or in softeare, by e.g. averaging the last 50 reads and wait till the majority is either off or on. This should be common knowledge for embedded programmers, but every noe and then you will see someone who has never heard of it. | |||||||||||||||||
| |||||||||||||||||