I have an inventory, basically list of object that i’m displaying, you can clic on each of them to get a modal of detail. This is fine, it works. But i want this inventory to be scrollable and i’m having a issue without any idea of how i can resolve that.
What is the expected result
I want to :
be able to “scroll” without triggering the “click”
be able to click without triggering the scroll
But how can i differentiate the two as they both work on pressing the button…
Should i work on a “timing” based solution ? What’s the best practice here ?
One method would be to use a timer and check how long the mouse down or touch has been active - if it’s over a threshold then scroll, otherwise click. But this won’t allow for a lingering mouse down/touch.
An alternative is to see how far the cursor has moved since the mouse down/touch began. If it’s over a threshold, scroll. If the mouse or touch finishes and scrolling hasn’t occurred, then click.