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

Problems about Keyboard Navigation #2788

Closed
BernieHuang2008 opened this issue Sep 16, 2023 · 14 comments · Fixed by #2790
Closed

Problems about Keyboard Navigation #2788

BernieHuang2008 opened this issue Sep 16, 2023 · 14 comments · Fixed by #2790
Labels
bug Something isn't working

Comments

@BernieHuang2008
Copy link
Contributor

BernieHuang2008 commented Sep 16, 2023

Version of SearXNG, commit number if you are using on master branch and stipulate if you forked SearXNG
since #2724 .

What happened?
When using arrowkey-navigation on first/last result, it will jump to bottom/top (that is, loop select).
I think it's not good for the UX, but seems you write a special code that cause this "bug".

if (next === null) {
next = results[0];
}

i think it shouldn't act like that, because users will be confused by this sudden jump.

How To Reproduce

  • Search anything
  • focus on the first result
  • press Arrow-Left
    and you will see the page has scrolled to bottom (the last result).

Expected behavior

do nothing

@BernieHuang2008 BernieHuang2008 added the bug Something isn't working label Sep 16, 2023
@return42
Copy link
Member

I think we should collect the issue we have with the keyboard navigation:

@BernieHuang2008
Copy link
Contributor Author

Do you mean a simple menu which you can choose one of the pre-defined layouts ?

@return42
Copy link
Member

Yes, currently we already have two layouts .. the default layout (with the Arrows you implemented) and the vim layout, which can be activated in the preferences:

image

The on-off checkbox should be replaced by a drop-down menu --> "default" & "vim-like" .. may be later -- when there is a need -- we can add more layouts .. or we add an option to select "none layout" ..

@BernieHuang2008
Copy link
Contributor Author

good idea, i will try it.
(when i finished your #2751 )

@return42
Copy link
Member

good idea, i will try it.

Thanks a lot for taking the time 👍

The thing with the preferences is a little tricky since (for historical reasons) currently the vim-like hotkeys are registered as a plugin (on/off switch) .. don't fight to long with this, I can then better take over this part (the preferences) of the work.

@BernieHuang2008
Copy link
Contributor Author

ok, you can do the preferences, and i will try to format the code to more extend-able.

@BernieHuang2008 BernieHuang2008 changed the title [bug] Arrow navigation: Loop scrolling Problems about Keyboard Navigation Sep 16, 2023
return42 pushed a commit to BernieHuang2008/searxng that referenced this issue Sep 16, 2023
- avoid loop select
- fix select next item in mixed result lists

Replaces: searxng#2789
Closes: searxng#2751
Closes: searxng#2788
@BernieHuang2008
Copy link
Contributor Author

BernieHuang2008 commented Sep 16, 2023

Can you pass the layout name to me by storing it in the variable searxng.settings.hotkeys?
for example,

searxng.settings.hotkeys = "vim";
OR
searxng.settings.hotkeys = "default";

or you may specified a variable.

@return42
Copy link
Member

return42 commented Sep 16, 2023

Yes I can .. was also what I had in mint, to use the hotkeys variable / this code will be changed to pass the selected value from the menu in the preferences to the JS on client side:

'hotkeys': req_pref.plugins.choices['searx.plugins.vim_hotkeys'],

@BernieHuang2008
Copy link
Contributor Author

My changes at https://github.com/BernieHuang2008/searxng/tree/feat-2788

return42 pushed a commit to BernieHuang2008/searxng that referenced this issue Sep 16, 2023
- avoid loop select
- fix select next item in mixed result lists

Replaces: searxng#2789
Closes: searxng#2751
Closes: searxng#2788
return42 pushed a commit that referenced this issue Sep 16, 2023
- avoid loop select
- fix select next item in mixed result lists

Replaces: #2789
Closes: #2751
Closes: #2788
@return42
Copy link
Member

return42 commented Sep 16, 2023

My changes at https://github.com/BernieHuang2008/searxng/tree/feat-2788

Thanks a lot .. I will cherry pick you patch and implement the preferences part .. when I finished I will send a PR (can take a while).

@BernieHuang2008
Copy link
Contributor Author

No need to be hurry, I shall go and finish my homework now ...

@return42
Copy link
Member

My changes at https://github.com/BernieHuang2008/searxng/tree/feat-2788

I cherry picked .. just FYI in your implementations you implemented a "vim" table and a "default" table .. in the old implementation the vim table was a merge, see --> To add Vim-like key bindings, merge the 'vimKeys' into 'keyBindings'.

.. I will squash the fix into your commit / you will see it when I send the PR.

@BernieHuang2008
Copy link
Contributor Author

Shall we move the hockey list into a config file? It's more likely to be there instead of in the source code.

@return42
Copy link
Member

I had already thought about that ... but let's finish the #2795 first. Afterwards we can cleanup the code .. at this opportunity we could also work on the point I mentioned above

clear the misuse/mess of the data-vim-selected attribute that is also used outside of a vim keyboard layout

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants