Skip to content

Commit 58bb761

Browse files
committed
fix keyboard selection
1 parent e782878 commit 58bb761

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

web_src/js/components/DiffCommitSelector.vue

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@ export default {
6767
this.toggleMenu();
6868
break;
6969
}
70+
if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {
71+
const item = document.activeElement; // try to highlight the selected commits
72+
const commitIdx = item?.matches('.item') ? item.getAttribute('data-commit-idx') : null;
73+
if (commitIdx) this.highlight(this.commits[commitIdx]);
74+
}
7075
},
7176
onKeyUp(event) {
7277
if (!this.menuVisible) return;
@@ -226,10 +231,11 @@ export default {
226231
</div>
227232
</div>
228233
<span v-if="!isLoading" class="info text light-2">{{ locale.select_commit_hold_shift_for_range }}</span>
229-
<template v-for="commit in commits" :key="commit.id">
234+
<template v-for="(commit, idx) in commits" :key="commit.id">
230235
<div
231236
class="item" role="menuitem"
232237
:class="{selected: commit.selected, hovered: commit.hovered}"
238+
:data-commit-idx="idx"
233239
@keydown.enter.exact="commitClicked(commit.id)"
234240
@keydown.enter.shift.exact="commitClickedShift(commit)"
235241
@mouseover.shift="highlight(commit)"
@@ -292,11 +298,6 @@ export default {
292298
background-color: var(--color-accent);
293299
}
294300
295-
.ui.dropdown.diff-commit-selector .menu > .item:focus {
296-
color: var(--color-text);
297-
background: var(--color-hover);
298-
}
299-
300301
.ui.dropdown.diff-commit-selector .menu .commit-list-summary {
301302
max-width: min(380px, 96vw);
302303
}

0 commit comments

Comments
 (0)