Skip to content

fix(AutoComplete): make close button functional#1860

Open
taufeeq31 wants to merge 1 commit intoRocketChat:mainfrom
taufeeq31:fix/autocomplete-close-button
Open

fix(AutoComplete): make close button functional#1860
taufeeq31 wants to merge 1 commit intoRocketChat:mainfrom
taufeeq31:fix/autocomplete-close-button

Conversation

@taufeeq31
Copy link

Proposed changes (including videos or screenshots)

This PR fixes the non-functional close/clear button in the AutoComplete component. Previously, the icon would switch to a 'cross' when the menu was open, but clicking it had no effect.

Changes:

  • Functional Clear: Implemented a handleClear function that clears the filter text, resets the selected value, and closes the dropdown.
  • Smart Interaction: Updated the Icon's onClick to trigger the clear action when the menu is visible, and focus the input when it is not.
  • Focus Management: Added onMouseDown prevention to the Icon to stop the input from blurring before the click is registered.

Demo

Screen.Recording.2026-02-06.at.11.24.33.PM.mov

Issue(s)

Closes #1296

Note on remaining behavior:

There is a small flicker in the dropdown when the clear button is clicked, likely due to event propagation and a brief re-render. This PR focuses only on making the close button functional.

@changeset-bot
Copy link

changeset-bot bot commented Feb 6, 2026

⚠️ No Changeset found

Latest commit: c139617

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

Autocomplete Close Button Not Functional

1 participant