Skip to content

Commit

Permalink
fix: wire up gapMode, fixes #65
Browse files Browse the repository at this point in the history
  • Loading branch information
theKashey committed Mar 16, 2023
1 parent 67da5b7 commit 455fda9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/UI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const FocusOn = React.forwardRef<HTMLElement, ReactFocusOnSideProps>(
preventScrollOnFocus,
style,
as,
gapMode,
...rest
} = props;

Expand All @@ -36,12 +37,18 @@ export const FocusOn = React.forwardRef<HTMLElement, ReactFocusOnSideProps>(

const appliedLockProps = {
...restProps,

as,
style,

sideCar,

shards,

allowPinchZoom,
as,
gapMode,
inert,
style,

enabled: enabled && scrollLock,
} as const;

Expand Down
9 changes: 9 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import * as React from 'react';
import ReactFocusLock from 'react-focus-lock/UI';
import {ComponentProps} from "react";

// TODO: reuse from react-remove-scroll-bar
export type GapMode = 'padding' | 'margin';

export interface LockProps {
onMouseDown?: ((e: React.MouseEvent) => void) | undefined;

Expand Down Expand Up @@ -49,6 +52,12 @@ export interface CommonProps {
* @see https://github.com/theKashey/react-remove-scroll#usage
*/
allowPinchZoom?: boolean | undefined;
/**
* [scroll-lock] Controls how body scroll removal is supported. Possible values - `margin` or `padding`
* @default 'margin'
* @see https://github.com/theKashey/react-remove-scroll-bar#gapmode
*/
gapMode?: GapMode;

/**
* a list of elements which should be considered as a part of the lock
Expand Down

0 comments on commit 455fda9

Please sign in to comment.