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

Adds new check to see if an element is covered by another #2251

Closed
wants to merge 4 commits into from
Closed

Adds new check to see if an element is covered by another #2251

wants to merge 4 commits into from

Conversation

poacher2k
Copy link
Contributor

Replaces #2166

@smblott-github
Copy link
Collaborator

The right-hand Suggested Groups pane on Facebook....

Before...

snapshot

After...

snapshot

We're now missing a lot of hints. Any ideas, @poacher2k?

@poacher2k
Copy link
Contributor Author

Good find! It seems that the case with these missing links is that the wrapping anchor tag itself doesn't have a any box size, and therefore only its children are found with document.getElementFromPoint.
anchor tags:
image
direct children:
image

I'll have to do some thinking here, as this is in theory correct behavior (click candiate is not in fact a visible element), but in practice not quite so.

Let me know if you come up with any ideas as well!

Also adds 0.1 pixels inwards to corner coordinates to handle some edge
cases where another element would be found instead
@poacher2k
Copy link
Contributor Author

@smblott-github I added a fix, and as far as I can see, things are working really smoothly now. Did some more extensive testing on facebook, reddit and github, and it seems to improve things a lot.

smblott-github added a commit to smblott-github/vimium that referenced this pull request Sep 24, 2016
smblott-github added a commit to smblott-github/vimium that referenced this pull request Sep 24, 2016
smblott-github pushed a commit to smblott-github/vimium that referenced this pull request Sep 24, 2016
(This message is written by @smblott-github.)

This is @poacher2k's philc#2251 rebased, tweaked and squashed into a single
commit.  It provides a new method of detecting when an overlay hides a
clickable element.

There is some possibility that this may have to be reverted (for
example, if we find we're missing too many important hints).  For that
reason, I squashed this into a single commit.

Closes philc#2251.

Adds another check to find out if elem is visible

Also adds 0.1 pixels inwards to corner coordinates to handle some edge
cases where another element would be found instead

Removes redundant contains-check

Reverts change that made tests fail

Tweak philc#2251 (better overlay detection).
smblott-github pushed a commit to smblott-github/vimium that referenced this pull request Sep 24, 2016
(This message is written by @smblott-github.)

This is @poacher2k's philc#2251 rebased, tweaked and squashed into a single
commit.  It provides a new method of detecting when an overlay hides a
clickable element.

There is some possibility that this may have to be reverted (for
example, if we find we're missing too many important hints).  For that
reason, I squashed this into a single commit.

Closes philc#2251.

Adds another check to find out if elem is visible

Also adds 0.1 pixels inwards to corner coordinates to handle some edge
cases where another element would be found instead

Removes redundant contains-check

Reverts change that made tests fail

Tweak philc#2251 (better overlay detection).
@smblott-github
Copy link
Collaborator

@poacher2k... See 5a32ecd.

I'm going to try it out for a bit before merging.

(Tests aren't passing for now.)

@poacher2k
Copy link
Contributor Author

I'm also trying it out, but yeah - I see tests aren't passing. Any clue on why, or hints on how to debug the tests that are failing?

smblott-github pushed a commit to smblott-github/vimium that referenced this pull request Sep 25, 2016
(This message is written by @smblott-github.)

This is @poacher2k's philc#2251 rebased, tweaked and squashed into a single
commit.  It provides a new method of detecting when an overlay hides a
clickable element.

There is some possibility that this may have to be reverted (for
example, if we find we're missing too many important hints).  For that
reason, I squashed this into a single commit.

Closes philc#2251.

Adds another check to find out if elem is visible

Also adds 0.1 pixels inwards to corner coordinates to handle some edge
cases where another element would be found instead

Removes redundant contains-check

Reverts change that made tests fail

Tweak philc#2251 (better overlay detection).
smblott-github pushed a commit to smblott-github/vimium that referenced this pull request Sep 25, 2016
(This message is written by @smblott-github.)

This is @poacher2k's philc#2251 rebased, tweaked and squashed into a single
commit.  It provides a new method of detecting when an overlay hides a
clickable element.

There is some possibility that this may have to be reverted (for
example, if we find we're missing too many important hints).  For that
reason, I squashed this into a single commit.

Closes philc#2251.

Adds another check to find out if elem is visible

Also adds 0.1 pixels inwards to corner coordinates to handle some edge
cases where another element would be found instead

Removes redundant contains-check

Reverts change that made tests fail

Tweak philc#2251 (better overlay detection).
@smblott-github
Copy link
Collaborator

@poacher2k... I'm still using this branch which includes your work tweaked and squashed. Are you too?

Do you have any sense as to whether it's faster or slower than the status quo?

I good test is to scroll a looooong way down on Twitter or Google Plus and then activate hints.

@poacher2k
Copy link
Contributor Author

@smblott-github: I'll do some tests on this after work today!

I believe the tweaked version (with only one check instead of two) is definitively faster than the one with two, but you might be talking about the main vimium branch?

@smblott-github
Copy link
Collaborator

is definitively faster than the one with two

That's what I think.

@poacher2k
Copy link
Contributor Author

Then I think we should go for that one. The reason I reverted the tweak was because Travis failed to build with the tweak and succeeded without it.

smblott-github added a commit to smblott-github/vimium that referenced this pull request Sep 26, 2016
@smblott-github
Copy link
Collaborator

Tests are fixed over in my branch of this: 1c66503.

The problem was that the tests were making too many assumptions about the implementation.

@poacher2k
Copy link
Contributor Author

That's great! I feared I had broken something. Will be testing with your branch soon.

@poacher2k
Copy link
Contributor Author

poacher2k commented Sep 26, 2016

I tested on twitter.com scrolled down far enough to make document.body.scrollHeight ~157k, and did some timings from F was pressed until hints appeared.

On master: ~0.7s
On poacher2k-master-squashed: ~0.84s
On poacher2k-master-squashed with tweak: ~0.7s

(tweak referring to only having elementFromPoint and element.contains elementFromPoint, removing or elementFromPoint.contains element)

Seems pretty solid to me, will do some more testing when I come back home.

@poacher2k
Copy link
Contributor Author

Tried going as far down I could on Twitter, Reddit and Facebook - all sites with loads of elements - and it never really goes more than ~0.9s for the link hints to show.

It should be said that at the bottom of Reddit/Twitter, the entire browsing experience gets sluggish - not just vimium.

@smblott-github
Copy link
Collaborator

@poacher2k... Thanks for that.

Now, a problem. From Facebook....

snapshot

master finds the link labelled "44" (probably the most important link!). Your approach (as implemented over in my other branch), does not. This happens consistently (for all Guardian posts), but I cannot find other examples.

@poacher2k
Copy link
Contributor Author

Hmm, I can't reproduce this it seems.

image

Do you experience it every time? Definitively worrisome, as that's the most important link for sure!

@poacher2k
Copy link
Contributor Author

poacher2k commented Sep 4, 2017

Is there any interest or point in me working this into the current codebase? As far as I can see, this is still an issue that when solved could improve the user experience on several websites.

Some examples:
github
GitHub
reddit
Reddit
YouTube
YouTube
Medium
Medium (only 4 of these are actually clickable with the mouse)

@poacher2k
Copy link
Contributor Author

Looking at the #2251 (comment) I realise I actually did reproduce it in #2251 (comment) .

Not really sure what is happening here (and the post is long gone), but I believe the "44" label may have been underneath the main post thumbnail and not actually visible although correctly placed.

I'll take extra notice of this if/when doing more work on this.

philc pushed a commit that referenced this pull request Jan 12, 2020
@philc
Copy link
Owner

philc commented Jan 12, 2020

I looked at this and followed the comment history, but couldn't find a the original rationale, or recent examples. However, I did reproduce this modern example from medium. 1st screenshot below is before this patch, 2nd is after. You can see that the 2nd screenshot omits many link hints which aren't clickable by the mouse because they're under an overlay, so they probably shouldn't be exposed by link hints (even though they are indeed clickable if the overlay is removed).

I've squashed this to one commit, tidied up some comments, and merged it into master in caf13c2. We can now easily test and revert this if it surfaces many suboptimal edge cases once it hits a wider audience.

I didn't want to lose this PR in the upcoming migration away from coffeescript.

CC @gdh1995 in case you've modified Vimium-C's linkhints in this way and have any commentary, or want to take this for a test spin before wider release.

Screen Shot 2020-01-12 at 2 45 42 PM
Screen Shot 2020-01-12 at 2 44 20 PM

@philc philc closed this Jan 12, 2020
@gdh1995
Copy link
Contributor

gdh1995 commented Jan 13, 2020

I haven't implemented this, maybe because of concerns about speed / code size. But this indeed looks well, and now I agree that it should be executed.

@poacher2k
Copy link
Contributor Author

Wow @philc , this is certainly a pleasant surprise! Thank you so much for looking at this! I've been eagerly wanting this ever since I made the PR in 2016! :)

@gnarendran
Copy link

This seems to break "Traverse shadow DOM to find links #3406" - particularly if the test on element.contains rejects shadow elements...

gdh1995 added a commit to gdh1995/vimium-c that referenced this pull request Feb 1, 2020
@philc
Copy link
Owner

philc commented Feb 9, 2020

Follow-up discussion about @gnarendran's comment is in #3474

@RomainBitard
Copy link

I believe this change makes me miss a lot of links that I could navigate before without the mouse, now I have to partially use the mouse some times (😞).
Am I the only one with this issue now ?

@poacher2k
Copy link
Contributor Author

@RomainBitard : would be great with some links and screenshots so that those issues can be ironed out in that case :)

@gnarendran
Copy link

gnarendran commented Feb 27, 2020

@RomainBitard : You are not alone, there are already followup issues #3492 #3493 #3501(closed). But I do not know if these three are the only regressions, or if you have encountered a different one. I guess that is why @poacher2k is requesting your problem links. Regards.

tripfish pushed a commit to tripfish/vimium that referenced this pull request Apr 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants