webstatus.dev icon indicating copy to clipboard operation
webstatus.dev copied to clipboard

Prepending a minus sign to a part of a query can change it radically through autocomplete

Open foolip opened this issue 11 months ago • 2 comments

Steps to reproduce:

  • https://webstatus.dev/?q=available_on%3Achrome+available_on%3Afirefox+available_on%3Asafari
  • Put the keyboard cursor right at the beginning of the query and type a "-"
  • Hit enter, hoping to see the updated search

What happens instead is this, after typing "-":

Image

When hitting enter, that commits the autocomplete suggestion, and I end up with the query "-available_date:chrome:2023-01-01..2024-01-01 available_on:firefox available_on:safari" instead, which isn't at all what I was trying to do.

cc @jcscottiii who I demo'd this to in a video call just now.

foolip avatar Jan 22 '25 15:01 foolip

Hi @foolip @jcscottiii for this issue I think the solution would either:

  1. the focus should stay on search box initially or
  2. include searched query in the results too like in google search.

Image Please tell me what is suggested, I am waiting. Thank you

suprith-hub avatar Mar 09 '25 10:03 suprith-hub

Hi, I tried to reproduce the issue. It seems like the issue only occurs when you click on the tag, as the search box auto-suggests the tag based on your cursor. However, If you directly click at the beginning of your query string and add '-', then it works fine.

https://github.com/user-attachments/assets/ce4ec9ae-7b2e-4290-b1a4-781f30cd15e5

I think, we should allow the user to focus entirely on the search box when they click on it, and show the suggestions if they 1) type or 2) select the whole tag to get similar suggestions

@jcscottiii @foolip Please let me know what works best for this case. I'd like to work on this.

r3yc0n1c avatar Apr 01 '25 21:04 r3yc0n1c

I'm still hitting this problem, and it's difficult to work around it even though I know what the bug is. @jrobbins are you familiar with how autocomplete is implemented?

foolip avatar Aug 13 '25 14:08 foolip

I think the solution is to only have the autocomplete menu replace text if the user has pressed down-arrow or clicked on an item in the menu. In other words, no item in the autocomplete menu should be selected unless the user hits at least one key to indicate that they want to use the autocomplete menu.

jrobbins avatar Aug 13 '25 22:08 jrobbins

@foolip Can you try again now?

We just shipped @jrobbins's fix.

jcscottiii avatar Aug 28 '25 13:08 jcscottiii