Commit 4b505e8
authored
Fix incorrect double invocation of menu items (#3766)
This PR fixes an issue where menu items would be invoked twice when you
click on an item.
This is due to a bug in the `useQuickRelease` hook where the timestamp
was not reset correctly, which means that the actual click caused a
quick release trigger. This in turn selects / invokes the menu item even
though it was already triggered by the click of the user.
This PR fixes that by resetting the timestamp as soon as possible, which
also cleans up the code a bit because there is only 1 branch where we
need to reset instead of in every branch before returning.
Fixes: #3763
Fixes: #3764
Fixes: #37651 parent 51b5bf6 commit 4b505e8
File tree
2 files changed
+10
-8
lines changed- packages/@headlessui-react
- src/hooks
2 files changed
+10
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| |||
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
99 | | - | |
| 99 | + | |
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| |||
0 commit comments