# Use click event to determine modifier keys \(\#22988\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/c28a4204ee77e964f798c8186a156aab5a277de6)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: c28a4204ee77e964f798c8186a156aab5a277de6

Requested commit: c28a4204ee77e964f798c8186a156aab5a277de6

Commit: c28a4204ee77e964f798c8186a156aab5a277de6

Tree: c023d88852979cf8e61828f30a4919f1c97b6148

Author: Shane Friedman

Committer: GitHub

## Message

```
Use click event to determine modifier keys (#22988)

Previously, editor elements had to listen for mouse_up events to
determine when a click had completed. This meant that they only had
access to modifier keys that were pressed during the mouse_up event.

This led to some incorrect user experiences, such as executing a
ctrl+click if the user pressed ctrl after pressing the mouse button, but
before releasing it.

This change adds a click event handler to EditorElement, and adds a
modifier() method to the ClickEvent, which only includes the modifier
keys that were pressed during both mouse down and mouse up. The code for
handling link clicks has been moved into the click event handler, so
that it's only triggered when the non-multi-cursor modifier was held for
both the mouse down and mouse up events.

Closes #12752, #16074, #17892 (the latter two seem to be duplicates of
the former!)

Release Notes:

- Fixed a bug where pressing ctrl/cmd (or other modifiers) after mouse
down but before mouse up still triggered ctrl/cmd+click behavior (e.g.
"go to definition")
```

## Parents

- [48922864657382f20af23afe7468598c5334d361](https://git.cafe/gitcafe/zed/commit/48922864657382f20af23afe7468598c5334d361?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/c28a4204ee77e964f798c8186a156aab5a277de6?format=markdown)
