From 770c9b9d984f1e41103bdb43cddb4a81b89b9a14 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Tue, 16 Jun 2026 10:49:53 +0100 Subject: [PATCH] fix: activate New row button via keyboard (Enter/Space) The New row control is a role=button div with no keydown handler, so Enter/Space never triggered it. It also lives inside the grid element, whose native keydown listener caught the Enter and ran cell navigation against the previously focused cell. Add Enter/Space activation to the button, and make the grid keyboard handler ignore keydowns that originate from a focusable child rather than the grid element itself, so in-grid controls handle their own keys. --- apps/client/src/ee/base/components/grid/add-row-button.tsx | 6 ++++++ apps/client/src/ee/base/hooks/use-grid-keyboard-nav.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/apps/client/src/ee/base/components/grid/add-row-button.tsx b/apps/client/src/ee/base/components/grid/add-row-button.tsx index 0131ecde1..f0838148b 100644 --- a/apps/client/src/ee/base/components/grid/add-row-button.tsx +++ b/apps/client/src/ee/base/components/grid/add-row-button.tsx @@ -16,6 +16,12 @@ export const AddRowButton = memo(function AddRowButton({
{ + if (e.key === "Enter" || e.key === " ") { + e.preventDefault(); + onClick?.(); + } + }} role="button" tabIndex={0} > diff --git a/apps/client/src/ee/base/hooks/use-grid-keyboard-nav.ts b/apps/client/src/ee/base/hooks/use-grid-keyboard-nav.ts index 9d09d79dc..f8bad8af1 100644 --- a/apps/client/src/ee/base/hooks/use-grid-keyboard-nav.ts +++ b/apps/client/src/ee/base/hooks/use-grid-keyboard-nav.ts @@ -166,6 +166,8 @@ export function useGridKeyboardNav({ return; } + if (e.target !== containerRef.current) return; + if (isTextEntry(document.activeElement)) return; if (e.key === "Escape") { @@ -263,6 +265,7 @@ export function useGridKeyboardNav({ } }, [ + containerRef, editingCell, focusedCell, getRowIds,