Skip to content

NcCheckboxRadioSwitch: onChange receives stale value on first spacebar keypress #8321

@pringelmann

Description

@pringelmann

Bug description

When using keyboard navigation to toggle a checkbox (NcCheckboxRadioSwitch in
checkbox mode), the onChange handler receives the previous (pre-toggle) value
on the first spacebar press. The correct updated value is only passed on the
second spacebar press.

Mouse clicks work correctly — onChange always receives the updated value.

This causes screen readers to announce the wrong state (e.g. "unchecked" when
the box is actually being checked), requiring a second press to get the correct
announcement.

Steps to reproduce

  1. Render an NcCheckboxRadioSwitch in checkbox mode
  2. Navigate to it with the keyboard
  3. Press Space to toggle it
  4. Observe: onChange is called with the old value, not the new one
  5. Press Space again — now onChange receives the correct value

Expected behavior

onChange should receive the updated (post-toggle) value on the first keypress,
consistent with mouse click behavior.

Additional info

Metadata

Metadata

Assignees

Labels

2. developingWork in progressaccessibilityMaking sure we design for the widest range of people possible, including those who have disabilitiesbugSomething isn't working

Type

No fields configured for Bug.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions