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

Change search box's "X" button behavior #382

Closed
JVimes opened this issue Sep 16, 2024 · 6 comments · Fixed by #388
Closed

Change search box's "X" button behavior #382

JVimes opened this issue Sep 16, 2024 · 6 comments · Fixed by #388
Labels
enhancement New feature or request

Comments

@JVimes
Copy link
Contributor

JVimes commented Sep 16, 2024

Feature Request

Summary

I thought the "X" button next to the search box would close the modal, but it seems to clear the search text instead.

Would it be better if it closed the modal?

Motivation

I was just confused by current behavior.

@JVimes JVimes added the enhancement New feature or request label Sep 16, 2024
@welpo
Copy link
Owner

welpo commented Sep 16, 2024

Hey @JVimes!

Thanks for sharing your confusion :) It's understandable.

I used other search bars for inspiration. I see Google, Kagi, and DuckDuckGo all use an X inside the search field to clear input.

However:

  • They only show the X after text has been entered (tabi always shows it, even with a blank query)
  • They are not modals

The GitHub search also shows the X after text has been entered, and it's kind of a modal.


My first solution would be to hide the X by default, and only show it if the search bar is not blank. Would that be clearer? I'm hoping the way to close modals is obvious to users (press Esc or click outside of it), but I'm not sure this is the case.

Another option I see, which could be added alongside the previous suggestion, is to add another X icon, outside the search input, to close the modal. Not as big of a fan of this one, though. Might look less clean.

I'm open to alternatives!

@JVimes
Copy link
Contributor Author

JVimes commented Sep 16, 2024

Ah, I see. Interesting problem. I think hiding the X until there's input would help.

One idea is, the X-and-Esc-key command could be overloaded: When there's text input, first run clears input and second run closes the modal. (Edit: the X is not hidden in this idea.)

@welpo
Copy link
Owner

welpo commented Sep 16, 2024

I appreciate the second idea, though I'm not sure it would be obvious behaviour.

I'll implement the "X only appears if input is not empty" for now. Once we see it live we can decide if it's enough :)

@JVimes
Copy link
Contributor Author

JVimes commented Sep 16, 2024

Sounds good to me! Thank you.

@welpo
Copy link
Owner

welpo commented Sep 19, 2024

@JVimes implemented the feature in #388. You can see the changes live on the demo.

What are your thoughts?

Hopefully the button's purpose is much clearer now!

@JVimes
Copy link
Contributor Author

JVimes commented Sep 19, 2024

That's great, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants