fix(base): sync header/body horizontal scroll on header focus; expand row via Space, drop expander from tab order

This commit is contained in:
Philipinho
2026-06-15 04:08:52 +01:00
parent cc951ae883
commit 8fc538386d
4 changed files with 31 additions and 5 deletions
@@ -38,7 +38,15 @@ export function useHorizontalScrollSync<
body.scrollLeft += e.deltaY;
};
const onHeaderScroll = () => {
if (rafId !== 0) return;
if (body.scrollLeft !== header.scrollLeft) {
body.scrollLeft = header.scrollLeft;
}
};
body.addEventListener("scroll", onBodyScroll, { passive: true });
header.addEventListener("scroll", onHeaderScroll, { passive: true });
header.addEventListener("wheel", onHeaderWheel, { passive: false });
// Initial sync in case the body is already scrolled when the hook mounts.
@@ -46,6 +54,7 @@ export function useHorizontalScrollSync<
return () => {
body.removeEventListener("scroll", onBodyScroll);
header.removeEventListener("scroll", onHeaderScroll);
header.removeEventListener("wheel", onHeaderWheel);
if (rafId !== 0) cancelAnimationFrame(rafId);
};