diff --git a/.changeset/hungry-stingrays-chew.md b/.changeset/hungry-stingrays-chew.md new file mode 100644 index 000000000..85e598388 --- /dev/null +++ b/.changeset/hungry-stingrays-chew.md @@ -0,0 +1,5 @@ +--- +"@ebay/ebayui-core": patch +--- + +Fix collapseOnSelect diff --git a/src/components/ebay-listbox-button/component.ts b/src/components/ebay-listbox-button/component.ts index 261896cb4..560c78b48 100644 --- a/src/components/ebay-listbox-button/component.ts +++ b/src/components/ebay-listbox-button/component.ts @@ -52,7 +52,7 @@ class ListboxButton extends Marko.Component { } handleListboxChange(event: ChangeEvent) { - if (this.input.collapseOnSelect === false) { + if (this.input.collapseOnSelect !== false) { this._expander.expanded = false; } const selectedIndex = event.index; diff --git a/src/components/ebay-listbox-button/test/test.browser.js b/src/components/ebay-listbox-button/test/test.browser.js index d32eb09c5..33c3ffbbb 100644 --- a/src/components/ebay-listbox-button/test/test.browser.js +++ b/src/components/ebay-listbox-button/test/test.browser.js @@ -157,6 +157,13 @@ describe("given the listbox is in an expanded state", () => { .has.property("selected") .and.is.deep.equal([options[1].value]); }); + + it("then it has collapsed the listbox", () => { + expect(component.getByRole("button")).toHaveAttribute( + "aria-expanded", + "false", + ); + }); }); describe("when the down arrow key is pressed", () => {