-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Visibility: onOnScreen doesn't fire if element is onScreen on first render #1911
Comments
There are a couple options for moving forward here. The current props related to this are:
You can try the SUI core examples for these here. However, the intent of the behavior detection is to fire on scroll only. There is currently no prop such as I think I would be OK adding an Thoughts? |
That seems very reasonable. The only question I'd have is what would happen in the following scenario:
Do the events fire again for the scroll related change? My assumption is that they wouldn't. In other words - |
once + intialGood question. I think the intuitive thing is to keep the behavior of The Naming change?The only other thing that bugs me here is
This makes me think we should probably go with the React lifecyle inspired prop name rather than invent a new SUI prop name. What about:
Feedback? |
Yes, I agree. fireOnMount is much more intuitive as well. I like it. |
Settled, PRs welcome 👍 |
Steps
The goal here is to create an element that has an image that only shows when the image is visible.
Expected Result
Actual Result
Images that are rendered on screen (above the fold) on the first render do not fire onOnScreen.
Version
0.69.0
Testcase
https://codepen.io/anon/pen/MvKPJX?editors=0010
Note, I just used icons in this example. The example says that the github icon should be 'users' when it is off screen and 'github' when it is onscreen. Notice that on initial load it is 'users'. If you scroll the window ever so slightly, it'll change to 'github'.
If there is another way I should be accomplishing this first render case, please let me know.
The text was updated successfully, but these errors were encountered: