Description
First off, let me say I'm very new to vimium, but after a just few days, I already love it! Though I have a few ideas / frustrations with link hints that might be able to make vimium even better.
The most problem I have with link hints is in in Google search results. The first result is almost always different from search. Additionally, either the first, second, or third links is essentially always what I click on, and it seems like these links should get one character link-hints such as the first, second, and third result always being "J","K", and "L" respectively.
The "google problem" was the first thing I noticed, but after that I began wondering how else could link-hints be improved. I began to realize by applying some understanding of how people make websites and the DOM, link-hints could be improved.
Picking what gets a single, home row character link-hint:
- Links inside a <"h"> links or in a <"strong"> matter and most probable for what to click on. These should likely be given priority of single letter hints
- Size matters. Large click areas or large font sizes are likely important and should given should be given priority over small links.
- Inputs matter. Especially if there is a singular, large input on a websites. Also, the first input in a form is important. You likely want to get there and then can use tab to move through the form.
Identifying sequences:
- Alignment matters. Going back to the google results example, each result is both in a <"h3"> and share the same exact same x-value. This could be a strong indicator of a important and sequential list that might deserve a "J", "K", "L" sequence or other sequence. Similarly, if links share the same y-value they could also be sequential list.
- Should make sure to understand priorities when considering whether a sequence should be given a home row sequence; The small site nav links at the bottom of a page may be in line, but that doesn't mean you're likely to click or that they should get a home row sequence.
Maintaining Consistency
- Site Consistency. This is sort of similar to f function #1850. One is the the google example where the first link should always be the same, but another is like when browsing a multi page article, slides, etc. the "next page" link should be the same each time. This is sort of like ]] but can be extend to things like the "Issues" tab on github should ideally keep the same link-hint. This can be detected with looking at the value of the content of an element or as brought up in f function #1850 maybe something with hashing the css.
- Global consistency. Websites share common element functions, shouldn't they share link hints? Almost every website has a "top-left-corner-logo-go-home" link. It would be nice if the link-hint was always the same website to website. Github usually (but not always, even in the same site) has it as "aa" which I kind of like, but maybe keys more closely to context of vim might be better like "gg" or something. Similarly, many websites have a large input thats high in the page with something like "search" in the class or id name. These usually serve the same function site to site and should get the same ideally vim inspired link-hint.
What about filter mode?
Turning on filtering link-hints makes this sort of not matter, but I find it takes more key strokes and is slower than the one or two character hints. This is especially true in google results where links often share first letters or even word. Also, in small links the pop-up can cover up the first letter, which takes a moment longer of thought and slows it down. Having context-sensitive and consistent link hints I think could make single and double character link-hints even faster by removing the aspect allowing you to predict what you will have to click, like always hitting "j" for first google result.
Implementation Ideas
I am interested helping implement this. What I am imagining now with only looking at the code a bit is a couple of heuristics like those mentioned above (font size, in header, strong, click size, etc) that are based on the link element and maybe its immediate parent. Links are put in a priority queue by "link importance score". There is also something watching for links that should be sequence or should have specific value for consistency and would add these to a "preassigned dictionary" instead of the queue. Things in the queue are poped off and get sequentially more complex link hints unless they are in the preassigned dictionary.
Still a lot thinking and looking through to better understand the current code to make this work. I didn't want too deep into without hearing some feedback from current contributors first. This would be my first time working with CoffeeScript, and I don't have much open source experience, but I am really interested in learning and trying to contribute.
These are just some ideas about where to start with context-sensitive and consistent link hints. I look forward to hearing what concerns, ideas, and comments actual contributors and the community have.
tl;dr: Links that are most likely to be clicked should be given priority for single character, home row link-hints, and there should be consistency with things the first, second, and third google result getting the same hint every time.