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

BUG | sometimes onVisibilityChanged is called with wrong visibility value #225

Open
NitzanShifrin opened this issue Sep 7, 2020 · 1 comment

Comments

@NitzanShifrin
Copy link

NitzanShifrin commented Sep 7, 2020

While working I encountered a very weird bug, I get a visibility change event, but with the wrong value.
Scrolling up and down the scroller, when having 1 object that I track visibility on, Sometimes I get false instead of true:
this is my log
visibility change true
visibility change false
visibility change true
visibility change false
visibility change false

How can this happened and is there anything to do to solve this?

And another unrelated question
I have a
< RecycleScroller ref="scroller">..
<v-for=myComponents>..
< /RecycleScroller>..

and in each of the myComponent, I have the vue-observe-visibility

Any chance to track an item before it gets visible - like on the edge of the scrolling? couldn't make it work with rootMargin

@NitzanShifrin NitzanShifrin changed the title sometimes onVisibilityChanged is called with wrong visibility value BUG | sometimes onVisibilityChanged is called with wrong visibility value Sep 7, 2020
@velis74
Copy link

velis74 commented May 18, 2021

Not sure it's the same thing, but I found this issue while looking for a solution to a problem of my own:

I'm using this directive to detect visibility on a table row. It works just fine, except in the following case:

Render the page, scroll a few pages down (table has a few hundred rows)
Reload the page (F5 or CTRL + F5)
The page will be displayed already scrolled down with the row in question already in view

The onVisibilityChanged will be called with isVisible == false

Using Firefox 88.0.1. This is NOT a problem in Chromium.

Edit: As I found, the problem is just the opposite: FF was behaving correctly and Chrome was not. I was attaching the v-observe-visibility to the first row and that row was not in viewport on FF (and also in Chrome). But for some reason chrome still triggered the handler.

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

No branches or pull requests

2 participants