-
-
Notifications
You must be signed in to change notification settings - Fork 2.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
Fixed main page scroll issue while popup open. #938
Conversation
WalkthroughThe changes introduced in this pull request primarily focus on improving the modularity and reusability of the code in the Changes
TipsChat with CodeRabbit Bot (
|
@prateekkalra is attempting to deploy a commit to the Typebot Team on Vercel. A member of the Team first needs to authorize 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.
Review Status
Actionable comments generated: 1
Files selected for processing (1)
- packages/embeds/js/src/features/popup/components/Popup.tsx (2 hunks)
Additional comments (Suppressed): 1
packages/embeds/js/src/features/popup/components/Popup.tsx (1)
- 92-104: The changes in
openBot
andcloseBot
functions are correct and improve the code's modularity by using thesetOverflow
function to manage theoverflow
property of thedocument.body
. This change doesn't alter the logic of the functions and should work as expected.
@@ -41,6 +41,8 @@ export const Popup = (props: PopupProps) => { | |||
popupProps.isOpen ?? false | |||
) | |||
|
|||
const setOverflow = value => document.body.style.setProperty('overflow', value, 'important'); |
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.
The setOverflow
function is a good abstraction for setting the overflow
property of the document.body
. However, it's recommended to check if document
and document.body
exist before accessing their properties. This is to avoid potential errors in environments where these objects might not be available, such as server-side rendering.
- const setOverflow = value => document.body.style.setProperty('overflow', value, 'important');
+ const setOverflow = value => {
+ if (typeof document !== 'undefined' && document.body) {
+ document.body.style.setProperty('overflow', value, 'important');
+ }
+ };
6d377b2
to
1cc4ccf
Compare
Solved first with #937 🙏 |
Made main page unscrollable made popup is visible.
/claim #763
Summary by CodeRabbit