Skip to content
This repository was archived by the owner on Apr 8, 2025. It is now read-only.

Hitting Enter uses the default search page #40

Closed
humitos opened this issue Jul 23, 2019 · 16 comments
Closed

Hitting Enter uses the default search page #40

humitos opened this issue Jul 23, 2019 · 16 comments
Labels
Improvement Minor improvement to code

Comments

@humitos
Copy link
Member

humitos commented Jul 23, 2019

Steps to reproduce it

  1. go to https://docs.readthedocs.io/en/latest/
  2. click on search
  3. type configuration
  4. hit Enter

Actual result

You are redirected to https://docs.readthedocs.io/en/latest/search.html?q=configuration&check_keywords=yes&area=default which is the default search (instead of the Search As You Type)

Expected result

I was expecting that it will just send the current query to the backend and do nothing, basically.

In case we want to have a fallback to the default search result, I think the usage of Enter has to be communicated in the UI.

@dojutsu-user
Copy link
Member

dojutsu-user commented Jul 23, 2019

This is the default behavior as of now.
As soon as the user starts typing... He is updated of the current status, in this case -- a message is shown to him -- Searching .....

I think it will be okay to mention this in docs?

@stsewd
Copy link
Member

stsewd commented Jul 23, 2019

I think we should select the first result, so when pressing enter the user can go to the page of that result.

@dojutsu-user
Copy link
Member

@stsewd
I am not sure that I followed your comment.
Can you explain a little more.

@stsewd
Copy link
Member

stsewd commented Jul 23, 2019

When searching, the popup window should have the first result selected, so when hitting enter, the user goes to the first result. No need to use arrow keys, tab or the mouse to select the first result.

edit: looks like is only possible to navigate the results with tab

@dojutsu-user
Copy link
Member

@stsewd
I don't think setting the first result as default will be good UI.

Also, it is possible to select the results with the ArrowUp and ArrowDown keys.

@stsewd
Copy link
Member

stsewd commented Jul 23, 2019

Also, it is possible to select the results with the ArrowUp and ArrowDown keys.

Sorry, I had an extension overriding that.

@dojutsu-user
Copy link
Member

I would like to know what will be good UI.
@readthedocs/core ?

@dojutsu-user dojutsu-user added the Needed: design decision A core team decision is required label Jul 24, 2019
@agjohnson
Copy link

Normal search function is to perform a search when hitting enter in a search box, we should preserve this. I expect that the search modal results will be updated when I hit enter. I don't expect to be dropped back into the default sphinx search results.

@dojutsu-user
Copy link
Member

@agjohnson
Our goal was to provide search-as-you-type capability -- I believe that user shouldn't have to hit enter to get the results.

@stsewd stsewd added Improvement Minor improvement to code and removed Needed: design decision A core team decision is required labels Jan 21, 2021
@stsewd
Copy link
Member

stsewd commented Jan 21, 2021

I'm fixing this in #81. The idea, is to select the first result, but have a link to the original search, this also helps in the case the api is down, so users can still go to the default search.

@agjohnson
Copy link

agjohnson commented Mar 8, 2021

Our goal was to provide search-as-you-type capability -- I believe that user shouldn't have to hit enter to get the results.

Sure, but they are, myself included 🙂

If the goal is to block the user from hitting enter, then we should capture this keypress and stop the event from propagating. It is unexpected UX to hit enter, whether accidentally or because you're used to text boxes accepting enter keypress as an action, and being dropped into a different UI.

I'm fixing this in #81. The idea, is to select the first result, but have a link to the original search, this also helps in the case the api is down, so users can still go to the default search.

@stsewd I think blocking the event from propagating/default event is fine. We just don't want to drop the user on the search.html page, I would be surprised to select the first search result automatically.

@stsewd
Copy link
Member

stsewd commented Mar 9, 2021

I would be surprised to select the first search result automatically.

But having enter do nothing feels weird, having the first item selected by default, so you can use enter to go the page is used by several applications (slack, algolia).

@humitos
Copy link
Member Author

humitos commented Mar 9, 2021

I'd expect that when hitting Enter,

  • if there are no results yet: results get updated (API is called immediately)
  • if there are results and nothing is selected: nothing happens
  • if there are results and one is selected: "click" on the selected result and open that page

I'm not 100% sure that we want to select the first result by default. I think it's confusing because if you type something, and hit enter, but milliseconds before you hit enter there were results you will end up in a page that you don't know why (the first result was clicked without notice it)

@stsewd
Copy link
Member

stsewd commented Mar 9, 2021

we are talking about the "search as you type" extension, so it is expected that you don't need to hit enter to search for something. We could change the placeholder to be more explicit like "type to start searching", even in the browser the first item is selected automatically

@agjohnson
Copy link

agjohnson commented Mar 11, 2021

we are talking about the "search as you type" extension, so it is expected that you don't need to hit enter to search for something.

That's the intended user interaction, but the effective user interaction is going to vary based on the user. We can avoid discrepancies between how people interpret an search as you type input box by making the interaction consistent. Myself, when I see a text box input like this, I assume I'm supposed to hit enter at the end to update the search results. If you don't interpret a search input like this, then you wouldn't press enter. Both users would have the same experience if we make enter update the search results.

But having enter do nothing feels weird

It wouldn't technically be doing nothing, but instead hitting enter could move focus away from the text input box, or could simple trigger a search event (similar to pausing typing), or both. I don't think we need an opinionated event here, but hitting enter needs to provide the user with some feedback.

@humitos humitos closed this as completed Apr 11, 2023
@humitos
Copy link
Member Author

humitos commented Apr 11, 2023

I'm closing this because the new "Search addon" won't trigger the "default search" since it knows nothing about it. So, my original problem is solved. Feel free to open a new issue in https://github.com/readthedocs/readthedocs-client/ if you think there are more things to discuss related to this topic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Improvement Minor improvement to code
Projects
None yet
Development

No branches or pull requests

4 participants