Skip to content

Commit

Permalink
fix(dropdown): remove preventDefault and stopPropagation on click eve…
Browse files Browse the repository at this point in the history
…nt (#3231)

* fix(dropdown): close on outside click when disable-close-on-select is true #3136

* fix(dropdown): remove preventDefault on click event. #1709
  • Loading branch information
driskull authored and y0n4 committed Oct 14, 2021
1 parent 75dd5c2 commit 87cfcca
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions src/components/calcite-dropdown/calcite-dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export class CalciteDropdown {
<Host tabIndex={this.disabled ? -1 : null}>
<div
class={{ ["calcite-dropdown-trigger-container"]: true, [CSS_UTILITY.rtl]: dir === "rtl" }}
onClick={this.openDropdown}
onClick={this.openCalciteDropdown}
onKeyDown={this.keyDownHandler}
ref={this.setReferenceEl}
>
Expand Down Expand Up @@ -383,18 +383,6 @@ export class CalciteDropdown {
this.popper = null;
}

private openDropdown = (e: Event): void => {
const target = e.target as HTMLSlotElement;
if (
this.triggers.includes(target) ||
this.triggers.some((trigger) => trigger.contains(target))
) {
e.preventDefault();
e.stopPropagation();
this.openCalciteDropdown();
}
};

private keyDownHandler = (e: KeyboardEvent): void => {
const target = e.target as HTMLSlotElement;
const key = getKey(e.key);
Expand Down

0 comments on commit 87cfcca

Please sign in to comment.