这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@dalf
Copy link
Contributor

@dalf dalf commented Jun 2, 2022

What does this PR do?

Currently the search input is auto focused except on mobile.

See issue #1270 : on the result page, in a small window on desktop, the result are hidden.

This PR enable the autofocus of the search input only on the index page and when the width is above 50em.


About .index_endpoint, the value is set in base.html :

<body class="{{ endpoint }}_endpoint" >

The endpoint Jinja2 variable is set to request.endpoint in the render function :

kwargs['endpoint'] = 'results' if 'q' in kwargs else request.endpoint

So the value is

  • index_endpoint for /
  • preferences_endpoint for /preferences
  • results_endpoint for /search (the expect value is search_endpoint, the results_endpoint value is a legacy from the time where /?q=%s was not a redirect ; this does not matter in this PR).

Why is this change important?

Improve the UX.

How to test this PR locally?

Author's checklist

Related issues

Related to #1270

@dalf dalf requested a review from mrpaulblack June 2, 2022 20:44
@dalf
Copy link
Contributor Author

dalf commented Jun 2, 2022

Note about the change on leaftet in this PR:

Copy link
Member

@mrpaulblack mrpaulblack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (autofocus works as described and leaflet also works, thanks)

@mrpaulblack mrpaulblack merged commit 045ce76 into searxng:master Jun 2, 2022
@dalf dalf deleted the issue-1270 branch June 2, 2022 21:48
@dalf dalf added the area: ui label Jun 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants