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

element-based navigation #1129

Open
KiaraGrouwstra opened this issue May 9, 2024 · 3 comments
Open

element-based navigation #1129

KiaraGrouwstra opened this issue May 9, 2024 · 3 comments
Labels

Comments

@KiaraGrouwstra
Copy link

KiaraGrouwstra commented May 9, 2024

What command or commands

Add a new mode to navigate elements on a page, not unlike arrow keys on duckduckgo.

How should a feature do

When a user has done such steps:

  1. Go to a URL with vertically placed items, e.g. https://github.com/gdh1995/vimium-c/issues
  2. Press a key (maybe c?)
  3. Start pressing arrow-like keys (down / up, j / k)

then Vimium C should do:

  1. Highlight, scroll to the right element, and focus its link to open if desired.

The user should also be able to exit this mode again.

I made something like this here (not tested as well with SPAs).

@gdh1995
Copy link
Owner

gdh1995 commented May 22, 2024

You may use LinkHints.click to switch focus among some elements.

For example, on a Google search result page, this will switch focus among search result items:

map xxx LinkHints.click mode="focus" match="a:has(h3)" directOptions={"offset":"cur","search":"doc","loop":1}
# then `xxx` will go down and `-xxx` will go up

Note: loop in directOptions requires Vimium C v2.0+ .

@KiaraGrouwstra
Copy link
Author

that's pretty cool! i hadn't realized vimium already offered things like this.
i feel that approach may still pose a barrier to casual users though, as it both requires a basic understanding of CSS selectors, while selectors like a:has(h3) are also circumstantial, making them harder to reuse across a wider range of web pages.
i'll admit the attempt i made also wasn't really perfect yet. but it'd be nice to see more general approaches explored here as well.

@gdh1995
Copy link
Owner

gdh1995 commented May 28, 2024

Yes a:has(h3) is too exact to reuse - it may not work on other websites.

You may use env to bind one key to multiple commands, like:

As for CSS knowledge, because Vimium C is designed to "advanced computer users" (especially programmers), it would not block Vimium C users, I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants