Skip to content

Commit

Permalink
feat: expose whitelist prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Nico Arehart committed Jul 20, 2020
1 parent ced053e commit fa5fe87
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import {FocusOn} from 'react-focus-on';
---
- `[autoFocus=true]` - enables or disables `auto focus` management (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))
- `[returnFocus=true]` - enables or disables `return focus` on lock deactivation (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))
- `[whiteList=fn]` - you could whitelist locations FocusLock should carry about. Everything outside it will ignore. For example - any modals (see [react-focus-lock documentation](https://github.com/theKashey/react-focus-lock))
---
- `[gapMode]` - the way removed ScrollBar would be _compensated_ - margin(default), or padding. See [scroll-locky documentation](https://github.com/theKashey/react-scroll-locky#gap-modes) to find the one you need.
- `[noIsolation]` - disables aria-hidden isolation
Expand Down
2 changes: 2 additions & 0 deletions src/UI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const FocusOn = React.forwardRef<HTMLElement, ReactFocusOnSideProps>(
allowPinchZoom,
sideCar,
className,
whiteList,
...rest
} = props;

Expand All @@ -43,6 +44,7 @@ export const FocusOn = React.forwardRef<HTMLElement, ReactFocusOnSideProps>(
onDeactivation={onDeactivation}
className={className}
as={RemoveScroll}
whiteList={whiteList}
lockProps={{
...restProps,
sideCar,
Expand Down
2 changes: 2 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ export interface ReactFocusOnProps extends CommonProps {

className?: string;
children: React.ReactNode;

whiteList?: (activeElement: HTMLElement) => boolean;
}

export interface ReactFocusOnSideProps extends ReactFocusOnProps {
Expand Down

0 comments on commit fa5fe87

Please sign in to comment.