bubblezone icon indicating copy to clipboard operation
bubblezone copied to clipboard

feature: workflow for de-duplicating mouse events when within a given zone

Open lrstanley opened this issue 3 years ago • 1 comments

✨ Describe the feature you'd like

A way with BubbleZone to reduce the chance of duplicated clicks being sent.

🌧 Is your feature request related to a problem?

Today, when holding one of the mouse buttons (and dragging), BubbleTea emits multiple events for each cell that the mouse has dragged over. The common way that I think most people use BubbleZone, where it's a simple bounds check, will be subject to situations where a user might intend on clicking something, then causing a drag during the clicking process (this isn't an issue unless they drag over a column/row boundary).


Not sure what the best approach to address this issue. Ideally, if we could capture a mouseup event, that is specific to left or right, I think that would be the ideal situation, rather than mousedown. A mousedown event can be triggered multiple times due to dragging, whereas I don't think mouseup would.

Today, I believe mouseup isn't specific to left/right.

Below screenshot shows an example of drag causing multiple events:


Maybe if the developer does an action based on a zone + mouse event, we have some way of caching that? And if we receive a mouseup event, we clear that cache? This would mean that unless we receive a mouseup event, we could have a way of checking if we've already done an action from mousedown for that zone?

lrstanley avatar Nov 06 '22 22:11 lrstanley

As part of bubbletea v2, this should be a non-issue, as users can simply watch for mouse up or mouse down events, which would only trigger once. Will close once v2 has been released.

lrstanley avatar Jul 07 '25 23:07 lrstanley