Skip to content

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

Merged
skjnldsv merged 1 commit into
mainfrom
fix/8321/checkbox-keyboard-stale-value
Mar 25, 2026
Merged

fix(NcCheckboxRadioSwitch): use reactive state for group checkbox toggle#8324
skjnldsv merged 1 commit into
mainfrom
fix/8321/checkbox-keyboard-stale-value

Conversation

@pringelmann

@pringelmann pringelmann commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

☑️ Resolves

🖼️ Screenshots

N/A - behavioral fix, no visual change

🚧 Tasks

  • Replace DOM queries (getInputsSet()) with reactive state reads in onToggle
  • Add unit tests for keyboard-driven group checkbox toggle

🏁 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

@pringelmann pringelmann self-assigned this Mar 19, 2026
@codecov

codecov Bot commented Mar 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 53.01%. Comparing base (9516f10) to head (513cd21).
⚠️ Report is 23 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8324      +/-   ##
==========================================
+ Coverage   52.37%   53.01%   +0.63%     
==========================================
  Files         104      104              
  Lines        3393     3388       -5     
  Branches      989      989              
==========================================
+ Hits         1777     1796      +19     
+ Misses       1360     1344      -16     
+ 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
@pringelmann pringelmann added bug Something isn't working feature: select Related to the NcSelect* components accessibility Making sure we design for the widest range of people possible, including those who have disabilities labels Mar 23, 2026
@pringelmann pringelmann force-pushed the fix/8321/checkbox-keyboard-stale-value branch from ad4c4a0 to 66b3d55 Compare March 23, 2026 20:14
@pringelmann pringelmann added feature: checkbox-radio-switch Related to the checkbox-radio-switch component and removed feature: select Related to the NcSelect* components labels Mar 23, 2026
@pringelmann pringelmann marked this pull request as ready for review March 23, 2026 20:27
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 force-pushed the fix/8321/checkbox-keyboard-stale-value branch from 66b3d55 to 513cd21 Compare March 23, 2026 20:28
@pringelmann pringelmann added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 23, 2026
@susnux

susnux commented Mar 24, 2026

Copy link
Copy Markdown
Contributor

/backport to stable8

@skjnldsv skjnldsv merged commit def5802 into main Mar 25, 2026
27 checks passed
@skjnldsv skjnldsv deleted the fix/8321/checkbox-keyboard-stale-value branch March 25, 2026 10:02
@Antreesy Antreesy modified the milestones: 9.6.0, 9.7.0 Apr 15, 2026
@Chartman123 Chartman123 linked an issue Jun 5, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews accessibility Making sure we design for the widest range of people possible, including those who have disabilities bug Something isn't working feature: checkbox-radio-switch Related to the checkbox-radio-switch component

Projects

None yet

Development

Successfully merging this pull request may close these issues.

a11y: Checkboxes not working correctly with keyboard NcCheckboxRadioSwitch: onChange receives stale value on first spacebar keypress

5 participants