fix(simple-single-select): clear selected option on ESC when option m…#1723
Conversation
kabaros
left a comment
There was a problem hiding this comment.
looking great, Celso - just a couple of small comments
| } | ||
|
|
||
| if (!expanded && clearable && key === 'Escape') { | ||
| onClear() |
There was a problem hiding this comment.
change this please to be more defensive, in case the consumer didn't pass the method
| onClear() | |
| onClear?.() |
| warning = false, | ||
| onBlur = () => undefined, | ||
| onClear = () => undefined, | ||
| onClear, |
There was a problem hiding this comment.
leave the default param here - just in case there are other places that are not being defensive / checking the value of onClear
| value: '', | ||
| })} | ||
| selected={selected} | ||
| setSelectedValue={setSelected} |
There was a problem hiding this comment.
I think you don't need to pass setSelectedValue anymore .. it's not used in the component
| setSelectedValue={setSelected} |
| expect(onChange).toHaveBeenCalledWith({ value: 'foo', label: 'Foo' }) | ||
| }) | ||
|
|
||
| it('should clear the selected value when closed, clearable and user presses Escape', () => { |
There was a problem hiding this comment.
as discussed on Slack - adding a second test for when it's open initially would be good
|
|
Great one Celso, thank you! 👏🏿 |
## [10.12.6](v10.12.5...v10.12.6) (2026-01-30) ### Bug Fixes * **simple-single-select:** clear selected option on ESC ([#1723](#1723)) ([65299b1](65299b1))



…enu is closed
Implements LIBS-821
Description
When the select is clearable, pressing ESC a second time now clears
the value if the popup is already dismissed, matching APG combobox
accessibility guidelines.
Known issues
Checklist
All points above should be relevant for feature PRs. For bugfixes, some points might not be relevant. In that case, just check them anyway to signal the work is done.
Screenshots
supporting text