Skip to content

[Bug] Button, IconButton, ToggleButton: holding Enter activates once per key repeat #8944

Open

Description

@duytbp

Description

Holding Enter on a Button, IconButton or ToggleButton activates it once per keyboard auto-repeat. A native <button> fires click on every repeated Enter keydown, and Button doesn't check KeyboardEvent.repeat: its only key handler runs when it is aria-disabled (Button.tsx:711-720), and the click path (Button.tsx:679-705) can't tell a repeat from a press. ToggleButton has no key handling at all.

So a held Enter on a ToggleButton flips it on and off about 30 times a second and leaves it in whichever state the key-up lands on. On a Button with onClick (or an interruptible clickAction) it runs the action many times: adding rows, stepping a counter, sending a message.

Astryx already rejects auto-repeat activation elsewhere: DropdownMenu (DropdownMenu.tsx:1248-1250), ContextMenu (ContextMenu.tsx:527-528) and Table activation (useTableActivation.spec.md FR8: "Keyboard auto-repeat never activates"). React Aria's usePress also ignores repeated key events, so one held key is one press.

Expected: one press per Enter key-down; repeats are ignored (for example, preventDefault() on a keydown with repeat set, for Enter, on the Button family).

Reproduction

import {useState} from 'react';
import {Button, ToggleButton} from '@astryxdesign/core';

export function Repro() {
  const [count, setCount] = useState(0);
  const [isBold, setIsBold] = useState(false);
  return (
    <>
      <Button label={`Add row (${count})`} onClick={() => setCount(c => c + 1)} />
      <ToggleButton label="Bold" isPressed={isBold} onPressedChange={setIsBold} />
    </>
  );
}
  1. Tab to "Add row" and hold Enter for a second: the count rises by about 30.
  2. Tab to "Bold" and hold Enter: it toggles on and off repeatedly.

Astryx Version

@astryxdesign/[email protected], still present on main (14fc587)

Environment

Chrome and Firefox on desktop (native button activation on Enter key auto-repeat). Not assistive-technology specific.

Activity

  1. added
    bug
    component
    on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    accessibilityarea:corebugcomponent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions