From 031b1d02fa3f8dc57b1153e8edeeb321eee46d70 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Sat, 29 Sep 2018 11:01:16 -0700 Subject: [PATCH] Right arrow keydown on focused preset list item now chooses the preset Left arrow keydown on focused preset list item now moves the focus to the category, if there is one --- modules/ui/preset_list.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/modules/ui/preset_list.js b/modules/ui/preset_list.js index 47dd22cbd..2d83c045e 100644 --- a/modules/ui/preset_list.js +++ b/modules/ui/preset_list.js @@ -234,11 +234,22 @@ export function uiPresetList(context) { search.node().focus(); } } - else if (d3_event.keyCode === d3_keybinding.keyCodes['→'] || - d3_event.keyCode === d3_keybinding.keyCodes['←']) { - // for consistency, don't propagate any arrow keys + // arrow left, move focus to the parent item if there is one + else if (d3_event.keyCode === d3_keybinding.keyCodes['←']) { d3_event.preventDefault(); d3_event.stopPropagation(); + + // if there is a parent item + if (!parentItem.empty()) { + // focus on the parent item + parentItem.select('.preset-list-button').node().focus(); + } + } + // arrow right, choose this item + else if (d3_event.keyCode === d3_keybinding.keyCodes['→']) { + d3_event.preventDefault(); + d3_event.stopPropagation(); + item.datum().choose(); } }