fix(web/menu): fix scrolling clipping menu items

This commit is contained in:
Luke
2022-08-02 10:59:46 +02:00
committed by Luke
parent ed3e7ac733
commit fd8b3c9862
2 changed files with 6 additions and 1 deletions

View File

@@ -15,6 +15,7 @@ const ListItem = forwardRef<Array<HTMLDivElement | null>, Props>(({ item, index,
bg="#25262B"
borderRadius="md"
tabIndex={index}
scrollMargin={2}
p={2}
height="60px"
key={`item-${index}`}

View File

@@ -111,7 +111,11 @@ const ListMenu: React.FC = () => {
useEffect(() => {
if (!menu.items[selected]) return;
listRefs.current[selected]?.focus();
listRefs.current[selected]?.scrollIntoView({
block: "nearest",
inline: "start",
});
listRefs.current[selected]?.focus({ preventScroll: true });
// debounces the callback to avoid spam
const timer = setTimeout(() => {
fetchNui(