Prepending a minus sign to a part of a query can change it radically through autocomplete
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 "-":
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.
Hi @foolip @jcscottiii for this issue I think the solution would either:
- the focus should stay on search box initially or
- include searched query in the results too like in google search.
Please tell me what is suggested, I am waiting. Thank you
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.
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?
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.
@foolip Can you try again now?
We just shipped @jrobbins's fix.