Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: close search button when clicking x #335

Merged
merged 1 commit into from
Oct 3, 2022
Merged

feat: close search button when clicking x #335

merged 1 commit into from
Oct 3, 2022

Conversation

nsilvestri
Copy link
Contributor

This PR adds behavior to the clear text "x" button while the geosearch is in button mode. If there is no text in the search input, the "x" button will additionally close the search input, exactly as if the primary search button itself was clicked. If there is text in in the search input, the button will behave as before, clearing the text but not closing the button.

As is, this PR does not make this behavior configurable. There are two reasons for this decision:

  1. There is no existing behavior being overwritten with this change, as clicking the "x" without any text is effective a no-op.
  2. There is little reason for a user to click the "x" if the text is already cleared. Therefore, it is reasonable to assume that a user clicking the "x" with an empty search input is not trying to clear text, but rather is attempting to close the search input, because clicking an "x" to close a window is an extremely common design pattern.

This change has no effect on the behavior of the bar variant.

This functionality was requested in #254.

@smeijer smeijer force-pushed the develop branch 3 times, most recently from 7618154 to 6453ded Compare October 3, 2022 19:26
@smeijer
Copy link
Owner

smeijer commented Oct 3, 2022

Thanks! This is really nice. Much appreciated.

@smeijer smeijer changed the title Close search button with x feat: close search button when clicking x Oct 3, 2022
@smeijer smeijer merged commit fdc8e7b into smeijer:develop Oct 3, 2022
@smeijer
Copy link
Owner

smeijer commented Oct 3, 2022

@all-contributors please add @nsilvestri for ideas, code

@allcontributors
Copy link
Contributor

@smeijer

I've put up a pull request to add @nsilvestri! 🎉

@smeijer
Copy link
Owner

smeijer commented Oct 3, 2022

🎉 This PR is included in version 3.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants