Skip to content

fix(NcCheckboxRadioSwitch): use reactive state for group checkbox toggle#8324

Draft
pringelmann wants to merge 1 commit intomainfrom
fix/8321/checkbox-keyboard-stale-value
Draft

fix(NcCheckboxRadioSwitch): use reactive state for group checkbox toggle#8324
pringelmann wants to merge 1 commit intomainfrom
fix/8321/checkbox-keyboard-stale-value

Conversation

@pringelmann
Copy link

The array/group checkbox path in onToggle read input.checked from the DOM via getInputsSet(). On keyboard spacebar, the browser toggles input.checked before firing the change event, so the DOM-read logic inverted the intended action and emitted the stale modelValue.

Replace DOM queries with reactive-state reads (this.isChecked and this.internalModelValue) which correctly reflect the pre-toggle state regardless of the event source.

Fixes #8321

β˜‘οΈ Resolves

  • Fix #…

πŸ–ΌοΈ Screenshots

🏚️ Before 🏑 After
B A

🚧 Tasks

  • ...

🏁 Checklist

  • ⛑️ Tests are included or are not applicable
  • πŸ“˜ Component documentation has been extended, updated or is not applicable
  • 2️⃣ Backport to stable8 for maintained Vue 2 version or not applicable

The array/group checkbox path in onToggle read input.checked from the
DOM via getInputsSet(). On keyboard spacebar, the browser toggles
input.checked before firing the change event, so the DOM-read logic
inverted the intended action and emitted the stale modelValue.

Replace DOM queries with reactive-state reads (this.isChecked and
this.internalModelValue) which correctly reflect the pre-toggle state
regardless of the event source.

Fixes #8321

Signed-off-by: Peter Ringelmann <peter.ringelmann@nextcloud.com>
@pringelmann pringelmann self-assigned this Mar 19, 2026
@codecov
Copy link

codecov bot commented Mar 19, 2026

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 53.01%. Comparing base (baefe78) to head (66b3d55).
⚠️ Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8324      +/-   ##
==========================================
+ Coverage   52.40%   53.01%   +0.60%     
==========================================
  Files         104      104              
  Lines        3393     3388       -5     
  Branches      989      988       -1     
==========================================
+ Hits         1778     1796      +18     
+ Misses       1359     1344      -15     
+ Partials      256      248       -8     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@artonge artonge added the 2. developing Work in progress label Mar 19, 2026
@artonge artonge added this to the 9.6.0 milestone Mar 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NcCheckboxRadioSwitch: onChange receives stale value on first spacebar keypress

2 participants