Skip to content
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

Add explicit crossFrame support for ReactFocusLock #73

Merged
merged 2 commits into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,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))
- `[crossFrame=true]` - enables or disables cross frame focus trapping. Setting this to false allows focus to move outside iframes (see [react-focus-lock issue](https://github.com/theKashey/react-focus-lock/issues/104))
---
- `[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 @@ -15,6 +15,7 @@ export const FocusOn = React.forwardRef<HTMLElement, ReactFocusOnSideProps>(
children,
autoFocus,
shards,
crossFrame,
enabled = true,
scrollLock = true,
focusLock = true,
Expand Down Expand Up @@ -61,6 +62,7 @@ export const FocusOn = React.forwardRef<HTMLElement, ReactFocusOnSideProps>(
returnFocus={returnFocus}
autoFocus={autoFocus}
shards={shards}
crossFrame={crossFrame}
onActivation={onActivation}
onDeactivation={onDeactivation}
className={className}
Expand Down
5 changes: 5 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ export interface ReactFocusOnProps extends CommonProps {
* @default false
*/
preventScrollOnFocus?: boolean | undefined;
/**
* [focus-lock] enables aggressive focus capturing within iframes
cee-chen marked this conversation as resolved.
Show resolved Hide resolved
* @default true
*/
crossFrame?: boolean | undefined;
/**
* [focus-lock] allows "ignoring" focus on some elements
* @see {@link https://github.com/theKashey/react-focus-lock#api}
Expand Down