fix(listbox): clicking disabled option no longer deselects current selection#247
fix(listbox): clicking disabled option no longer deselects current selection#247ianmcburnie merged 2 commits intomasterfrom
Conversation
…lection (#246) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This PR fixes makeup-listbox so that clicking an aria-disabled="true" option does not clear the current selection, aligning mouse behavior with the existing navigation-emitter handling for disabled items.
Changes:
- Add an
aria-disabledguard to the listbox_onClickhandler to prevent callingselect()for disabled options. - Add Playwright coverage for both manual-select and auto-select listbox variants with a pre-selected option to ensure disabled clicks preserve selection.
- Regenerate distribution (
dist/) and docs (docs/ui/...) bundled artifacts to include the fix.
Reviewed changes
Copilot reviewed 2 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/ui/makeup-listbox/src/index.js | Prevents click-selection logic from running when the clicked option is aria-disabled="true". |
| packages/ui/makeup-listbox/test/index.spec.js | Adds regression tests ensuring disabled option clicks don’t deselect the currently selected item (manual + auto select). |
| packages/ui/makeup-listbox/dist/mjs/index.js | Rebuilt ESM bundle containing the click guard. |
| packages/ui/makeup-listbox/dist/cjs/index.js | Rebuilt CJS bundle containing the click guard. |
| docs/ui/makeup-listbox/index.min.js | Rebuilt docs bundle containing the click guard. |
| docs/ui/makeup-listbox/index.min.js.map | Updated sourcemap for the rebuilt docs bundle. |
| docs/ui/makeup-listbox-button/index.min.js | Rebuilt docs bundle (includes listbox code) containing the click guard. |
| docs/ui/makeup-listbox-button/index.min.js.map | Updated sourcemap for the rebuilt listbox-button docs bundle. |
| docs/ui/makeup-combobox/index.min.js | Rebuilt docs bundle (includes listbox code) containing the click guard. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…l paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
@copilot review again |
Reviewed — the code looks good. Here's a summary of the current state:
Tests: |
aria-disabled="true") in a listbox was incorrectly deselecting the currently selected itemselect()calledunselect()before checking whether the target item was disabled, so any call path (mouse click, Space/Enter keyboard, auto-select on navigation, or programmatic) could clear the current selection when targeting a disabled optionaria-disabledguard to the top ofselect()so thatunselect()is never called when the target option is disabled — covering all call sites, not just_onClick_onListboxClickinmakeup-listbox-buttonto not collapse the overlay when a disabled option is clickedTest plan
makeup-listbox-buttonconfirming the overlay stays open when clicking a disabled option