-
Notifications
You must be signed in to change notification settings - Fork 339
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
adding option to fill scrollbar gap #14
Conversation
@@ -62,7 +77,7 @@ const handleScroll = (event: HandleScrollEvent, targetElement: any): boolean => | |||
return true; | |||
}; | |||
|
|||
export const disableBodyScroll = (targetElement: any): void => { | |||
export const disableBodyScroll = (targetElement: any, options?: BodyScrollOptions): void => { |
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.
would you need to apply the same options
to enableBodyScroll
on line 124?
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.
No, that's not really necessary. Padding is automatically reset when setOverflowAuto()
is called. I can't imagine a use case where you want to fill the gap but don't want to reset 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.
good point
src/bodyScrollLock.js
Outdated
@@ -22,10 +27,16 @@ const preventDefault = (rawEvent: HandleScrollEvent): boolean => { | |||
return false; | |||
}; | |||
|
|||
const setOverflowHidden = () => { | |||
const setOverflowHidden = (options?: BodyScrollOptions) => { | |||
const reserveScrollBarGab = !!options && options.reserveScrollBarGap === true; |
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.
just a typo here reserveScrollBarGap
instead of reserveScrollBarGab
Could you also update the README @martinkutter re the options parameter? then we're good to go, thanks for the PR |
@willmcpo I fixed the typo and added a suggestion for the documentation. |
No description provided.