Skip to content

Commit

Permalink
fix(combobox): prevent spacebar from opening the menu when focused on…
Browse files Browse the repository at this point in the history
… chip's close button (#8990)

**Related Issue:** #6777

## Summary

Prevent spacebar from opening the menu when focused on chip's `close`
button.

Fixes a regression introduced in
#8909.
  • Loading branch information
Elijbet committed Mar 25, 2024
1 parent 2b7a3d2 commit 1a20d0e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
Expand Up @@ -1959,7 +1959,7 @@ describe("calcite-combobox", () => {

const wrapper = await page.find("calcite-combobox >>> .wrapper");
const close = await wrapper.find("calcite-chip >>> .close");
await close.click();
await close.press(" ");
await page.waitForChanges();

const remainingChips = await page.findAll("calcite-combobox >>> calcite-chip");
Expand Down
Expand Up @@ -681,17 +681,13 @@ export class Combobox
}
break;
case " ":
if (!this.textInput.value) {
if (!this.textInput.value && !event.defaultPrevented) {
if (!this.open) {
this.open = true;
this.shiftActiveItemIndex(1);
}
event.preventDefault();
}

if (event.composedPath().find((el: HTMLElement) => el.tagName === "CALCITE-CHIP")) {
event.preventDefault();
}
break;
case "Home":
if (!this.open) {
Expand Down

0 comments on commit 1a20d0e

Please sign in to comment.