Page MenuHomePhabricator

Prevent stray clicks to rollback icons
Open, LowPublic

Description

This task was imported from this GitLab issue.

Original description:

Describe your suggestion
With great speed comes great capacity to make mistakes, and stray clicks are a common occurrence due to the way the DOM quickly flexes to make space for RedWarn. Additionally, RedWarn no longer displays a dialog for quick rollback buttons, making it easy to misclick. Thus, it may be important to implement a method to block stray clicks if the rollback icons have been inserted within a short enough period of time.
The plan is to block, or ask confirmation for, clicks to RedWarn rollback icons if the icon had only been inserted to the DOM less than 200ms prior. This should be enough time to avoid accidental stray clicks due to insertion.
An additional idea is to also block movement-based stray clicks, meaning asking for confirmation if the cursor was moving too fast prior to clicking (to a threshold to be determined sometime).
This should hopefully decrease the occurrence of stray clicks both due to DOM insertion or rapid mouse movement.
An alternative to (or possibly a better choice versus) this idea is providing a cancel button which prevents sending the edit API request. This wastes a bit of data (due to the earlier page content pull), however can prevent actions given enough reaction time. We can also just trout anyone who makes mistakes.
Settings
For both blocks, there should be an option to configure whether the action a) is blocked entirely, b) requires confirmation, or c) is permitted. Additionally, the threshold as to how early since DOM insertion and how fast the cursor is moving should also be configurable. Since this feature may be annoying to some users, the possibility of having this safety feature disabled by default should be considered.

Additional notes/context:

would make it more than 200ms, maybe 400ms ish to make it more in line with human response times - I don't think we need a continue prompt, we can just not set a click handler until then so if it doesn't work somebody will do the natural thing and click it again

Wasn't really thinking of a prompt. More of a "glass button case" where the icon swaps, along with a message slightly above indicating what happened. I'm more against the idea of delaying the addition of a click handler, since having even more code that strays from the normal code flow would be a pain. Additionally, false feedback can make the user think something is wrong with RedWarn. In fact, they might even hesitate to click twice due to the volatility of the action. The former proposed method provides reasonable feedback indicating what went wrong, and a customizable way to disable it for those who have innately quick response times.