Skip to content

Commit

Permalink
fix(dropdown): remove eventListener
Browse files Browse the repository at this point in the history
  • Loading branch information
mistermalm committed Feb 17, 2025
1 parent ded82f5 commit fb2199e
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions packages/core/src/components/dropdown/dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -501,20 +501,24 @@ export class TdsDropdown {
});
};

private resetInput = () => {
const inputEl = this.host.querySelector('input');
if (inputEl) {
this.reset();
}
};

componentDidRender() {
const form = this.host.closest('form');
if (form) {
form.addEventListener('reset', () => {
// HANDLE UNTOUCHED...
this.resetInput();
});
form.addEventListener('reset', this.resetInput);
}
}

resetInput() {
const inputEl = this.host.querySelector('input');
if (inputEl) {
this.reset();
disconnectedCallback() {
const form = this.host.closest('form');
if (form) {
form.removeEventListener('reset', this.resetInput);
}
}

Expand Down

0 comments on commit fb2199e

Please sign in to comment.