Fix pane magnification causing mouse to drag tabs unexpectedly (#26383)
Previously, if a user clicked a button and moved the cursor out before releasing, the click event was correctly prevented, but the pending mouse-down state remained. This caused unintended drags when the UI shifted due to magnification settings. Now, mouse-up clears the pending state: - If over the button → clear state and trigger click handlers. - If outside the button → clear state without triggering a click. This avoids accidental drags while preserving expected click behavior. Closes #24600 Release Notes: - N/A --------- Co-authored-by: Ben Kunkle <ben@zed.dev>
This commit is contained in:
parent
a3ca5554fd
commit
21cf2e38c5
1 changed files with 8 additions and 0 deletions
|
@ -1948,6 +1948,14 @@ impl Interactivity {
|
|||
if pending_mouse_down.is_some() && hitbox.is_hovered(window) {
|
||||
captured_mouse_down = pending_mouse_down.take();
|
||||
window.refresh();
|
||||
} else if pending_mouse_down.is_some() {
|
||||
// Clear the pending mouse down event (without firing click handlers)
|
||||
// if the hitbox is not being hovered.
|
||||
// This avoids dragging elements that changed their position
|
||||
// immediately after being clicked.
|
||||
// See https://github.com/zed-industries/zed/issues/24600 for more details
|
||||
pending_mouse_down.take();
|
||||
window.refresh();
|
||||
}
|
||||
}
|
||||
// Fire click handlers during the bubble phase.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue