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

Improvements for :navigate prev/next heuristics #6696

Open
The-Compiler opened this issue Sep 20, 2021 · 7 comments
Open

Improvements for :navigate prev/next heuristics #6696

The-Compiler opened this issue Sep 20, 2021 · 7 comments
Labels
component: hints Issues related to hinting ("f" key). priority: 2 - low Issues which are currently not very important.

Comments

@The-Compiler
Copy link
Member

As reported by keir in IRC, using ]] on ddg result pages results in loading some kind of "more information" link for bangs being loaded, rather than the "more results" button.

@The-Compiler The-Compiler added component: hints Issues related to hinting ("f" key). priority: 2 - low Issues which are currently not very important. labels Sep 20, 2021
@lyeoh
Copy link
Contributor

lyeoh commented Oct 23, 2021

I had a look at the duckduckgo page and it looks like there are two problems.

The first is that the correct element is called "More results" while the page also contains a bunch of other elements with the word "more", e.g. "more images" and the element that leads to the information page about bangs.

The second problem is that even when navigate._find_prevnext returns the correct element, i.e.

<a href="javascript:;" class="result--more__btn btn btn--full">
    More results
</a>

more results aren't loaded and the tab title is changed to javascript:;. One fix is altering _prevnext_cb to run elem.click(usertypes.ClickTarget.normal) instead of opening the url elem.resolve_url(baseurl).

@The-Compiler
Copy link
Member Author

@lyeoh Also see #454

@agenbite
Copy link
Contributor

agenbite commented Nov 5, 2021

Maybe this is unrelated, but shouldn't navigate next take into account the language of the site? I mean, a site with "siguiente" or "anterior" ("next" and "previous" in Spanish) doesn't seem to work. I tried google.es and google.com, and the later works but the former doesn't.

Another option would be to follow Vimium's approach and let the user define a set of symbols for calling next and previous with navigate.

@The-Compiler
Copy link
Member Author

@agenbite there are the hints.prev_regexes and hints.next_regexes settings.

@agenbite
Copy link
Contributor

agenbite commented Nov 5, 2021

That's great! Thank you so much for this so well-thought software!!

However, I'm not being able to make it work in this case. Apparently it has nothing to do with language, after all.

The code involved in navigation is this:

<button type="button" class="image-gallery-icon image-gallery-left-nav icon-arrow-left" aria-label="Previous Slide"></button>

I've tried this:

c.hints.prev_regexes.append(r'\bleft\b')
c.hints.prev_regexes.append(r'\bPrevious Slide\b')
c.hints.next_regexes.append(r'\bright\b')
c.hints.next_regexes.append(r'\bNext Slide\b')

To no avail so far. :( Any help would be appreciated.

@toofar
Copy link
Member

toofar commented Nov 5, 2021

I think there are two things stopping us from picking up the buttons on that site:

  1. the prev/next element detection only looks at link elements by default, not buttons (and that one doesn't have any of the classes we look for either)
  2. the regexes only look at the element text, we don't look at the aria-label attribute, so that setting wont help

@agenbite
Copy link
Contributor

agenbite commented Nov 8, 2021

Would this be the same thing that happens with Twitter's next/prev image? I get:

<div aria-label="Next slide" role="button" tabindex="0" class="css-18t94o4 css-1dbjc4n r-42olwf r-sdzlij r-1phboty r-rs99b7 r-hv52eu r-2yi16 r-1qi8awa r-1ny4l3l r-o7ynqc r-6416eg r-lrvibr" style="backdrop-filter: blur(4px); background-color: rgba(64, 14, 10, 0.75);"><div dir="auto" class="css-901oao r-1awozwy r-jwli3a r-6koalj r-18u37iz r-16y2uox r-37j5jr r-a023e6 r-b88u0q r-1777fci r-rjixqe r-bcqeeo r-q4m81j r-qvutc0"><svg viewBox="0 0 24 24" aria-hidden="true" class="r-jwli3a r-4qtqp9 r-yyyyoo r-z80fyv r-dnmrzs r-bnwqim r-1plcrui r-lrvibr r-19wmn03"><g><path d="M19.707 11.293l-6-6c-.39-.39-1.023-.39-1.414 0s-.39 1.023 0 1.414L16.586 11H4c-.553 0-1 .447-1 1s.447 1 1 1h12.586l-4.293 4.293c-.39.39-.39 1.023 0 1.414.195.195.45.293.707.293s.512-.098.707-.293l6-6c.39-.39.39-1.023 0-1.414z"></path></g></svg><span class="css-901oao css-16my406 css-bfa6kz r-poiln3 r-a023e6 r-rjixqe r-bcqeeo r-qvutc0"></span></div></div>

When browsing the images of this tweet.

If that's the case, maybe it'd be nice to have the 'aria-label' and/or button considered...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: hints Issues related to hinting ("f" key). priority: 2 - low Issues which are currently not very important.
Projects
None yet
Development

No branches or pull requests

4 participants