From 929a27b384edd89f00ac58dc8225d0d82e406381 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Mon, 4 Mar 2019 13:56:34 -0500 Subject: [PATCH] Allow arrow key navigation out of expanded subsections --- css/80_app.css | 2 +- modules/ui/search_add.js | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/css/80_app.css b/css/80_app.css index b7c914476..2613a02fc 100644 --- a/css/80_app.css +++ b/css/80_app.css @@ -680,7 +680,7 @@ button.add-note svg.icon { .search-add .list-item button.choose:focus { background: #fff; } -.search-add .list-item.focused:not(.disabled) button { +.search-add .list-item.focused:not(.disabled) button.choose { background: #e8ebff; } .search-add .list-item button.choose.disabled { diff --git a/modules/ui/search_add.js b/modules/ui/search_add.js index 8f6b92a2e..258f50cd6 100644 --- a/modules/ui/search_add.js +++ b/modules/ui/search_add.js @@ -69,6 +69,12 @@ export function uiSearchAdd(context) { nextFocus = d3_select(priorFocus.nodes()[0].nextElementSibling) .selectAll('.list-item:first-child'); } + if (nextFocus.empty()) { + var parentSubsection = priorFocus.nodes()[0].closest('.list .subsection'); + if (parentSubsection && parentSubsection.nextElementSibling) { + nextFocus = d3_select(parentSubsection.nextElementSibling); + } + } } if (!nextFocus.empty()) { focusListItem(nextFocus); @@ -81,10 +87,17 @@ export function uiSearchAdd(context) { priorFocus = popover.selectAll('.list .list-item.focused'); if (!priorFocus.empty()) { + nextFocus = d3_select(priorFocus.nodes()[0].previousElementSibling); if (!nextFocus.empty() && !nextFocus.classed('list-item')) { nextFocus = nextFocus.selectAll('.list-item:last-child'); } + if (nextFocus.empty()) { + var parentSubsection = priorFocus.nodes()[0].closest('.list .subsection'); + if (parentSubsection && parentSubsection.previousElementSibling) { + nextFocus = d3_select(parentSubsection.previousElementSibling); + } + } if (!nextFocus.empty()) { focusListItem(nextFocus); priorFocus.classed('focused', false);