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
- Render an
NcCheckboxRadioSwitch in checkbox mode
- Navigate to it with the keyboard
- Press Space to toggle it
- Observe:
onChange is called with the old value, not the new one
- 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
Bug description
When using keyboard navigation to toggle a checkbox (
NcCheckboxRadioSwitchincheckbox mode), the
onChangehandler receives the previous (pre-toggle) valueon the first spacebar press. The correct updated value is only passed on the
second spacebar press.
Mouse clicks work correctly —
onChangealways 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
NcCheckboxRadioSwitchin checkbox modeonChangeis called with the old value, not the new oneonChangereceives the correct valueExpected behavior
onChangeshould receive the updated (post-toggle) value on the first keypress,consistent with mouse click behavior.
Additional info