feat: improve list keyboard navigation

This commit is contained in:
thecodrr
2022-02-11 23:42:59 +05:00
parent 435caa1e79
commit 027133a0f3
2 changed files with 6 additions and 2 deletions

View File

@@ -51,7 +51,7 @@
"react-scrollbars-custom": "^4.0.25",
"react-toggle": "^4.1.2",
"react-virtualized-auto-sizer": "^1.0.4",
"react-virtuoso": "^1.9.3",
"react-virtuoso": "^2.4.0",
"rebass": "^4.0.7",
"showdown": "github:thecodrr/showdown",
"streamablefs": "file:packages/streamablefs",

View File

@@ -78,7 +78,11 @@ function ListContainer(props) {
}
if (isUp || isDown) {
listRef.current.scrollToIndex(nextIndex);
listRef.current.scrollIntoView({
index: nextIndex,
behavior: "auto",
});
e.preventDefault();
const listItem = listContainerRef.current.querySelector(
`[data-item-index="${nextIndex}"]`
);