I'm writing a VueJS application that will have a custom context menu that appears when the user mouses over a particular item on the page. The menu is dynamic meaning that it will change as the user hovers over different items. If the user holds down the control key the menu will be static so that they can interact with the items in the menu.
My issue is the while the @keydown.ctrl="..."
event seems to respond as intended the @keyup.ctrl="..."
event does not. I have looked around and tried different modifiers such as .exact
and .caputure
but they don't seem to solve the issue.
What does work however is changing @keyup.ctrl
to @keyup.control
. The .control
works on the @keyup
event but not for the @keydown
event.
What is the difference between @keydown
and @keyup
that would require the use of different key modifiers?
Below is an example of what the root element looks like.
<div
tabindex="0"
@keydown.esc.exact="() => (displayContext = false)"
@keydown.ctrl.exact="() => (keepContext = true)"
@keyup.control="() => (keepContext = false)"
>
...
</div>