-
Notifications
You must be signed in to change notification settings - Fork 302
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
feat(@toss/react): Add root Props ImpressionArea #283
Conversation
👷 Deploy request for slash-libraries pending review.Visit the deploys page to approve it
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good improvement.
What kind of situation did you actually need to give a root to?(in real programming)
Could you write a test code to verify this change?
@ChanhyukPark-Tech However, I recently had an experience with (Not exactly a storybook issue, but more of an Please refer to the following videos that I shared! 🙏 root: null (Unusual behavior 🥲)ezgif.com-gif-maker.7.movroot: document (Normal behavior 😄)ezgif.com-gif-maker.8.movI found a documentation related to the issue.
Solutionconst observer = new IntersectionObserver(callback, {
root: document, // (*)
rootMargin: '300px 0px 300px 0px',
}); Additionally, in my opinion, it seems quite difficult to write test code with the root option applied using the existing test code settings… 😱 As a result, There's a clear problem with storybook(actually iframe), adding the root option doesn't have any side effects, and it's the default option for Intersection Observer, so I don't think it's a bad idea to add it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for preparing a good example and reference and producing this pr.
Someone might need this option
@ChanhyukPark-Tech |
@ssi02014 |
Overview
I worked on adding "root" props to the "Impression Area".
"root" props is one of the default options for "Intersection Observer". How about adding a corresponding "root" prop?
I think it's better to cover a wider range of cases by providing a default option that can be utilized.
For example, The root option has issues with iframes.
Of course, by default, the Viewport is applied as root (null), which I agree is appropriate in most cases. So, it would be great if you could review it.
Also, I don't think the code I've been working on will cause problems with older versions of the code. 🤗
PR Checklist