Skip to content

Remove clear button listeners when autocomplete is destroyed - #164

Open
feritcemkahraman wants to merge 1 commit into
github:mainfrom
feritcemkahraman:fix-clear-button-listener-cleanup
Open

feritcemkahraman wants to merge 1 commit into
github:mainfrom
feritcemkahraman:fix-clear-button-listener-cleanup

Conversation

@feritcemkahraman

Copy link
Copy Markdown

After an autocomplete disconnects, its clear button still clears the old input and emits a change event. Reconnecting the element adds another handler, so subsequent clicks emit duplicate changes.

Remove the clear button's click listener alongside the other listeners in destroy().

The new Chromium regression fails before the fix and passes after it. All 51 Chromium tests, including the existing accessibility checks, pass. TypeScript, bundle/manifest generation, changed-file ESLint/format checks, and source ESLint with formatting disabled pass. Full lint reports unchanged Windows CRLF formatting differences; Firefox/WebKit were not run.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Cleanup matches the registered handler, and the regression test covers both reported failures.

0 open findings

What changed in this PR

Fixes autocomplete lifecycle cleanup so clear-button clicks do not affect disconnected inputs or emit duplicate changes after reconnection.

Changes:

  • Remove the clear-button click listener in destroy().
  • Add regression coverage for disconnection and reconnection.
File Description
test/​auto-complete-element.js Verifies disconnected clicks do nothing and reconnected clicks emit one change.
src/​autocomplete.ts Removes the clear-button handler alongside other listeners.

🧠 Review effort: Max


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants