test(channels): cover ActionMenu keyboard-skip + stats ETA value; drop redundant disabledIndices

Deep-review follow-up on R13 S3.

- Add a roving-keyboard-nav test proving a disabled ActionMenu item is
  skipped by arrow keys, and assert the stats "left" row renders the
  formatEta value (formatEta had no coverage anywhere).
- Remove the disabledIndices plumbing from AnchoredPopover + ActionMenu:
  it was redundant. useListNavigation already skips items via their DOM
  disabled/aria-disabled attribute, and PopoverItem renders a native
  disabled button — verified against @floating-ui/react 0.27
  isListIndexDisabled and by a mutation test. Behaviour is unchanged and
  now guarded by the new test.
This commit is contained in:
2026-08-15 04:45:32 +02:00
parent bb2d6999fd
commit 5838cf1c56
4 changed files with 53 additions and 15 deletions
+4 -9
View File
@@ -31,15 +31,10 @@ export default function ActionMenu({
trigger?: ReactNode;
}) {
const [open, setOpen] = useState(false);
// A disabled item (a mutation already in flight) can't take DOM focus, so roving keyboard nav must
// SKIP it — otherwise ArrowUp/Down strands the highlight on an inert button. The platform handles it.
const disabledIndices = items.flatMap((it, i) => (it.disabled ? [i] : []));
const pop = useAnchoredPopover({
open,
onOpenChange: setOpen,
placement: "bottom-end",
disabledIndices,
});
// A disabled item (a mutation already in flight) is skipped by roving keyboard nav automatically:
// PopoverItem renders it as a native `disabled` button, which useListNavigation reads and never
// focuses. No explicit disabledIndices needed. See ActionMenu.dom.test.tsx for the guard.
const pop = useAnchoredPopover({ open, onOpenChange: setOpen, placement: "bottom-end" });
return (
<>
<button