Fix issue where sidebar controls could be keyboard-navigated while the sidebar was hidden

This commit is contained in:
Quincy Morgan
2020-10-29 10:29:27 -04:00
parent d70f2e2e0f
commit 3727f26c13
2 changed files with 14 additions and 2 deletions

View File

@@ -812,6 +812,9 @@ a.hide-toggle {
left: -6px;
}
.sidebar.collapsed > *:not(.sidebar-resizer) {
display: none;
}
.sidebar.collapsed .sidebar-resizer {
/* make target wider to avoid the user accidentally resizing window */
width: 10px;

View File

@@ -379,7 +379,13 @@ export function uiSidebar(context) {
endMargin = 0;
}
selection.transition()
if (!isCollapsing) {
// unhide the sidebar's content before it transitions onscreen
selection.classed('collapsed', isCollapsing);
}
selection
.transition()
.style(xMarginProperty, endMargin + 'px')
.tween('panner', function() {
var i = d3_interpolateNumber(startMargin, endMargin);
@@ -390,7 +396,10 @@ export function uiSidebar(context) {
};
})
.on('end', function() {
selection.classed('collapsed', isCollapsing);
if (isCollapsing) {
// hide the sidebar's content after it transitions offscreen
selection.classed('collapsed', isCollapsing);
}
// switch back from px to %
if (!isCollapsing) {