Fix arrow key navigation

This commit is contained in:
Quincy Morgan
2019-03-12 10:23:26 -04:00
parent fa3756d4b2
commit a076c54ed5
3 changed files with 24 additions and 20 deletions
+5 -4
View File
@@ -653,13 +653,14 @@ button.add-note svg.icon {
.search-add .popover .list {
max-height: 70vh;
}
.search-add .list-item {
.search-add .list-item > .row {
display: flex;
position: relative;
padding: 2px;
}
.search-add .list-item:not(:last-of-type),
.search-add .subsection > * {
.search-add .list-item:not(:last-of-type) .row,
.search-add .subsection.subitems .list-item .row,
.search-add .subsection > .tag-reference-body {
border-bottom: 1px solid #DCDCDC;
}
.search-add .list-item .label {
@@ -687,7 +688,7 @@ button.add-note svg.icon {
[dir='rtl'] .search-add .list-item .label .icon.inline {
margin-right: 0;
}
.search-add .list-item > *:not(button) {
.search-add .list-item .row > *:not(button) {
pointer-events: none;
}
.search-add .list-item button.choose {
+13 -12
View File
@@ -154,10 +154,9 @@ export function uiSearchAdd(context) {
if (priorFocus.empty()) {
nextFocus = popover.selectAll('.list > .list-item:first-child');
} else {
nextFocus = popover.selectAll('.list .list-item.focused + .list-item');
if (nextFocus.empty()) {
nextFocus = d3_select(priorFocus.nodes()[0].nextElementSibling)
.selectAll('.list-item:first-child');
nextFocus = d3_select(priorFocus.nodes()[0].nextElementSibling);
if (!nextFocus.empty() && !nextFocus.classed('list-item')) {
nextFocus = nextFocus.selectAll('.list-item:first-child');
}
if (nextFocus.empty()) {
parentSubsection = priorFocus.nodes()[0].closest('.list .subsection');
@@ -268,7 +267,7 @@ export function uiSearchAdd(context) {
function drawList(list, data) {
list.selectAll('.subsection').remove();
list.selectAll('.subsection.subitems').remove();
var dataItems = data.map(function(preset) {
return itemForPreset(preset);
@@ -294,7 +293,7 @@ export function uiSearchAdd(context) {
function drawItems(selection) {
var row = selection
var item = selection
.append('div')
.attr('class', 'list-item')
.attr('id', function(d) {
@@ -315,6 +314,9 @@ export function uiSearchAdd(context) {
.classed('focused', false);
});
var row = item.append('div')
.attr('class', 'row');
row.append('button')
.attr('class', 'choose')
.on('click', function(d) {
@@ -372,17 +374,16 @@ export function uiSearchAdd(context) {
d3_select(this).call(presetFavorite.button);
}
});
row.each(function(d) {
item.each(function(d) {
if ((d.geometry && !d.isSubitem) || d.geometries) {
var reference = uiTagReference(d.preset.reference(d.geometry || d.geometries[0]), context);
var thisRow = d3_select(this);
thisRow.call(reference.button, 'accessory', 'info');
var thisItem = d3_select(this);
thisItem.selectAll('.row').call(reference.button, 'accessory', 'info');
var selector = '#' + thisRow.node().id + ' + *';
var subsection = d3_select(thisRow.node().parentElement)
.insert('div', selector)
var subsection = thisItem
.append('div')
.attr('class', 'subsection reference');
subsection.call(reference.body);
}
+6 -4
View File
@@ -119,8 +119,9 @@ export function uiTagReference(what) {
_showing = true;
_button.selectAll('svg.icon use').each(function(iconUse) {
if (iconUse.attr && iconUse.attr('href') === '#iD-icon-info') {
_button.selectAll('svg.icon use').each(function() {
var iconUse = d3_select(this);
if (iconUse.attr('href') === '#iD-icon-info') {
iconUse.attr('href', '#iD-icon-info-filled');
}
});
@@ -139,8 +140,9 @@ export function uiTagReference(what) {
_showing = false;
_button.selectAll('svg.icon use').each(function(iconUse) {
if (iconUse.attr && iconUse.attr('href') === '#iD-icon-info-filled') {
_button.selectAll('svg.icon use').each(function() {
var iconUse = d3_select(this);
if (iconUse.attr('href') === '#iD-icon-info-filled') {
iconUse.attr('href', '#iD-icon-info');
}
});