This commit is contained in:
João Moreno
2021-09-29 16:49:26 +02:00
parent e50637bc5f
commit bea6b60cd1
2 changed files with 17 additions and 4 deletions
+14 -4
View File
@@ -307,7 +307,9 @@ class KeyboardController<T> implements IDisposable {
e.preventDefault();
e.stopPropagation();
this.list.focusPrevious(1, false, e.browserEvent);
this.list.reveal(this.list.getFocus()[0]);
const el = this.list.getFocus()[0];
this.list.setAnchor(el);
this.list.reveal(el);
this.view.domNode.focus();
}
@@ -315,7 +317,9 @@ class KeyboardController<T> implements IDisposable {
e.preventDefault();
e.stopPropagation();
this.list.focusNext(1, false, e.browserEvent);
this.list.reveal(this.list.getFocus()[0]);
const el = this.list.getFocus()[0];
this.list.setAnchor(el);
this.list.reveal(el);
this.view.domNode.focus();
}
@@ -323,7 +327,9 @@ class KeyboardController<T> implements IDisposable {
e.preventDefault();
e.stopPropagation();
this.list.focusPreviousPage(e.browserEvent);
this.list.reveal(this.list.getFocus()[0]);
const el = this.list.getFocus()[0];
this.list.setAnchor(el);
this.list.reveal(el);
this.view.domNode.focus();
}
@@ -331,7 +337,9 @@ class KeyboardController<T> implements IDisposable {
e.preventDefault();
e.stopPropagation();
this.list.focusNextPage(e.browserEvent);
this.list.reveal(this.list.getFocus()[0]);
const el = this.list.getFocus()[0];
this.list.setAnchor(el);
this.list.reveal(el);
this.view.domNode.focus();
}
@@ -339,6 +347,7 @@ class KeyboardController<T> implements IDisposable {
e.preventDefault();
e.stopPropagation();
this.list.setSelection(range(this.list.length), e.browserEvent);
this.list.setAnchor(undefined);
this.view.domNode.focus();
}
@@ -347,6 +356,7 @@ class KeyboardController<T> implements IDisposable {
e.preventDefault();
e.stopPropagation();
this.list.setSelection([], e.browserEvent);
this.list.setAnchor(undefined);
this.view.domNode.focus();
}
}
@@ -61,6 +61,7 @@ async function navigate(widget: WorkbenchListWidget | undefined, updateFocusFn:
widget.reveal(listFocus[0]);
}
widget.setAnchor(listFocus[0]);
ensureDOMFocus(widget);
}
@@ -404,6 +405,7 @@ function selectElement(accessor: ServicesAccessor, retainCurrentFocus: boolean):
if (focused instanceof List || focused instanceof PagedList || focused instanceof Table) {
const list = focused;
list.setSelection(list.getFocus(), fakeKeyboardEvent);
list.setAnchor(list.getFocus()[0]);
}
// Trees
@@ -425,6 +427,7 @@ function selectElement(accessor: ServicesAccessor, retainCurrentFocus: boolean):
}
}
tree.setSelection(focus, fakeKeyboardEvent);
tree.setAnchor(focus[0]);
}
}