Commit 58e5f43
committed
fix: handle Enter/Space key on focused dropdown link items
When navigating to a link item in a dropdown menu using keyboard and
pressing Enter or Space, the link was not being followed. Instead, the
menu would close and reopen with the first item focused.
The issue was that handleEnterOrSpace only checked if the dropdown
button had browser focus, but menu items use aria-activedescendant
pattern with tabindex="-1", so they never receive actual browser focus.
Now the handler first checks for items with the data-focus attribute
(our visual focus indicator) and simulates a click on them, which
properly triggers link navigation for link items or click handlers
for button items.1 parent cb8b200 commit 58e5f43
File tree
2 files changed
+25
-1
lines changed- assets/js/hooks
- demo/test/wallaby/demo_web
2 files changed
+25
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
151 | 151 | | |
152 | 152 | | |
153 | 153 | | |
154 | | - | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
155 | 162 | | |
156 | 163 | | |
157 | 164 | | |
| |||
Lines changed: 17 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
64 | 81 | | |
0 commit comments