Skip to content

Commit d4c8a76

Browse files
committed
fix: remove react-focus-lock
1 parent c295aa5 commit d4c8a76

File tree

5 files changed

+17
-90
lines changed

5 files changed

+17
-90
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@
150150
"object-assign": "4.1.1",
151151
"react-aria": "^3.10.0",
152152
"react-aria-modal": "^2.11.1",
153-
"react-focus-lock": "2.11.3",
154153
"react-toastify": "^9.0.8",
155154
"react-uid": "^2.2.0",
156155
"react-verification-input": "^4.1.2",

src/components/ModalContainer/ModalContainer.types.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { CSSProperties, ReactNode, ComponentProps, AriaRole } from 'react';
1+
import { CSSProperties, ReactNode, AriaRole } from 'react';
22
import type { PlacementType } from '../ModalArrow/ModalArrow.types';
3-
import { FocusScope } from '@react-aria/focus';
3+
import type { FocusScopeProps } from '@react-aria/focus';
44
import { AriaLabelRequired } from '../../utils/a11y';
55

66
export type Color = 'primary' | 'secondary' | 'tertiary' | 'quaternary';
@@ -86,5 +86,5 @@ export type Props = AriaLabelRequired & {
8686
/**
8787
* Props to be passed to FocusLock
8888
*/
89-
focusLockProps?: Omit<ComponentProps<typeof FocusScope>, 'children' | 'key' | 'css'>;
89+
focusLockProps?: Omit<FocusScopeProps, 'children' | 'key' | 'css'>;
9090
};

src/components/OverlayAlert/OverlayAlert.types.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import type { CSSProperties, ReactElement, ReactNode, ComponentProps } from 'react';
2-
import FocusLock from 'react-focus-lock';
1+
import type { CSSProperties, ReactElement, ReactNode } from 'react';
2+
import type { FocusScopeProps } from '@react-aria/focus';
33

44
import type { ButtonControlProps } from '../ButtonControl';
55
import type { ButtonSimpleProps } from '../ButtonSimple';
@@ -21,8 +21,9 @@ export type Props = OverlayProps &
2121
*/
2222
title: string;
2323
}
24-
| ({ title?: never } & AriaLabelRequired) // if a title is not provided, a label is required
24+
| ({ title?: never } & AriaLabelRequired)
2525
) & {
26+
// if a title is not provided, a label is required
2627
/**
2728
* Actions associated with this OverlayAlert.
2829
*/
@@ -71,7 +72,7 @@ export type Props = OverlayProps &
7172
/**
7273
* Props to be passed to Overlay for FocusLock, default `{returnFocus: true}`
7374
*/
74-
focusLockProps?: Omit<ComponentProps<typeof FocusLock>, 'children'>;
75+
focusLockProps?: Omit<FocusScopeProps, 'children' | 'key' | 'css'>;
7576

7677
/**
7778
* Callback function to be fired when Escape key is pressed.

src/legacy/EventOverlay/index.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import React from 'react';
44
import PropTypes from 'prop-types';
55
import ReactDOM from 'react-dom';
66
import omit from 'lodash/omit';
7-
import FocusLock from 'react-focus-lock';
7+
import { FocusScope } from '@react-aria/focus';
88

99
const defaultDims = {
1010
offsetTop: 0,
@@ -984,7 +984,13 @@ class EventOverlay extends React.Component {
984984
);
985985

986986
const withFocusLock = (content) =>
987-
shouldLockFocus ? <FocusLock {...focusLockProps}>{content}</FocusLock> : content;
987+
shouldLockFocus ? (
988+
<FocusScope {...focusLockProps} contain>
989+
{content}
990+
</FocusScope>
991+
) : (
992+
content
993+
);
988994

989995
const withPortal = (content) =>
990996
portalNode ? ReactDOM.createPortal(content, portalNode) : content;

yarn.lock

Lines changed: 1 addition & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,7 +1786,7 @@ __metadata:
17861786
languageName: node
17871787
linkType: hard
17881788

1789-
"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.1, @babel/runtime@npm:^7.12.13, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.14.0, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.0, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.6.2, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7":
1789+
"@babel/runtime@npm:^7.0.0, @babel/runtime@npm:^7.1.2, @babel/runtime@npm:^7.10.2, @babel/runtime@npm:^7.11.2, @babel/runtime@npm:^7.12.1, @babel/runtime@npm:^7.12.5, @babel/runtime@npm:^7.13.10, @babel/runtime@npm:^7.14.0, @babel/runtime@npm:^7.3.1, @babel/runtime@npm:^7.5.0, @babel/runtime@npm:^7.5.5, @babel/runtime@npm:^7.6.2, @babel/runtime@npm:^7.7.2, @babel/runtime@npm:^7.7.6, @babel/runtime@npm:^7.8.4, @babel/runtime@npm:^7.8.7":
17901790
version: 7.14.8
17911791
resolution: "@babel/runtime@npm:7.14.8"
17921792
dependencies:
@@ -3110,7 +3110,6 @@ __metadata:
31103110
react-aria: ^3.10.0
31113111
react-aria-modal: ^2.11.1
31123112
react-dom: 16.14.0
3113-
react-focus-lock: 2.11.3
31143113
react-hot-loader: ^4.2.0
31153114
react-router-dom: ^5.0.0
31163115
react-test-renderer: ^16.8.0
@@ -12878,13 +12877,6 @@ __metadata:
1287812877
languageName: node
1287912878
linkType: hard
1288012879

12881-
"detect-node-es@npm:^1.1.0":
12882-
version: 1.1.0
12883-
resolution: "detect-node-es@npm:1.1.0"
12884-
checksum: e46307d7264644975b71c104b9f028ed1d3d34b83a15b8a22373640ce5ea630e5640b1078b8ea15f202b54641da71e4aa7597093bd4b91f113db520a26a37449
12885-
languageName: node
12886-
linkType: hard
12887-
1288812880
"detect-node@npm:^2.0.4":
1288912881
version: 2.1.0
1289012882
resolution: "detect-node@npm:2.1.0"
@@ -15110,15 +15102,6 @@ __metadata:
1511015102
languageName: node
1511115103
linkType: hard
1511215104

15113-
"focus-lock@npm:^1.3.5":
15114-
version: 1.3.5
15115-
resolution: "focus-lock@npm:1.3.5"
15116-
dependencies:
15117-
tslib: ^2.0.3
15118-
checksum: 09fb0e4402694aabafa8f7d49a656f683bbf39c94efc0c0240934d880792ef86d8c11bb7d77ef6f5d68ccfdfb7f191ecc2b38a259182a6791bcf96860a408d1c
15119-
languageName: node
15120-
linkType: hard
15121-
1512215105
"focus-trap-react@npm:^3.0.4":
1512315106
version: 3.1.4
1512415107
resolution: "focus-trap-react@npm:3.1.4"
@@ -24755,17 +24738,6 @@ __metadata:
2475524738
languageName: node
2475624739
linkType: hard
2475724740

24758-
"react-clientside-effect@npm:^1.2.6":
24759-
version: 1.2.6
24760-
resolution: "react-clientside-effect@npm:1.2.6"
24761-
dependencies:
24762-
"@babel/runtime": ^7.12.13
24763-
peerDependencies:
24764-
react: ^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0
24765-
checksum: 7db6110027a51458b1a46109d2b63dd822825f483c71afef7c0c0a671f3b1aa155049dbd8651c9d536ffac83601f8823b7c3f8916b4f4ee5c3cb7647a85cce4e
24766-
languageName: node
24767-
linkType: hard
24768-
2476924741
"react-colorful@npm:^5.1.2":
2477024742
version: 5.3.0
2477124743
resolution: "react-colorful@npm:5.3.0"
@@ -24910,26 +24882,6 @@ __metadata:
2491024882
languageName: node
2491124883
linkType: hard
2491224884

24913-
"react-focus-lock@npm:2.11.3":
24914-
version: 2.11.3
24915-
resolution: "react-focus-lock@npm:2.11.3"
24916-
dependencies:
24917-
"@babel/runtime": ^7.0.0
24918-
focus-lock: ^1.3.5
24919-
prop-types: ^15.6.2
24920-
react-clientside-effect: ^1.2.6
24921-
use-callback-ref: ^1.3.2
24922-
use-sidecar: ^1.1.2
24923-
peerDependencies:
24924-
"@types/react": ^16.8.0 || ^17.0.0 || ^18.0.0
24925-
react: ^16.8.0 || ^17.0.0 || ^18.0.0
24926-
peerDependenciesMeta:
24927-
"@types/react":
24928-
optional: true
24929-
checksum: 2d2e191e802ecc9dc5cf5ebf5a8e71bba3e93caccadfa3d08276e08dad97bee90afb819054393a455423757acb8e028f2d1251fd71a46554b95a97aa0f0c18bf
24930-
languageName: node
24931-
linkType: hard
24932-
2493324885
"react-helmet-async@npm:^1.0.7":
2493424886
version: 1.0.9
2493524887
resolution: "react-helmet-async@npm:1.0.9"
@@ -29514,21 +29466,6 @@ __metadata:
2951429466
languageName: node
2951529467
linkType: hard
2951629468

29517-
"use-callback-ref@npm:^1.3.2":
29518-
version: 1.3.2
29519-
resolution: "use-callback-ref@npm:1.3.2"
29520-
dependencies:
29521-
tslib: ^2.0.0
29522-
peerDependencies:
29523-
"@types/react": ^16.8.0 || ^17.0.0 || ^18.0.0
29524-
react: ^16.8.0 || ^17.0.0 || ^18.0.0
29525-
peerDependenciesMeta:
29526-
"@types/react":
29527-
optional: true
29528-
checksum: df690f2032d56aabcea0400313a04621429f45bceb4d65d38829b3680cae3856470ce72958cb7224b332189d8faef54662a283c0867dd7c769f9a5beff61787d
29529-
languageName: node
29530-
linkType: hard
29531-
2953229469
"use-composed-ref@npm:^1.0.0":
2953329470
version: 1.1.0
2953429471
resolution: "use-composed-ref@npm:1.1.0"
@@ -29566,22 +29503,6 @@ __metadata:
2956629503
languageName: node
2956729504
linkType: hard
2956829505

29569-
"use-sidecar@npm:^1.1.2":
29570-
version: 1.1.2
29571-
resolution: "use-sidecar@npm:1.1.2"
29572-
dependencies:
29573-
detect-node-es: ^1.1.0
29574-
tslib: ^2.0.0
29575-
peerDependencies:
29576-
"@types/react": ^16.9.0 || ^17.0.0 || ^18.0.0
29577-
react: ^16.8.0 || ^17.0.0 || ^18.0.0
29578-
peerDependenciesMeta:
29579-
"@types/react":
29580-
optional: true
29581-
checksum: 925d1922f9853e516eaad526b6fed1be38008073067274f0ecc3f56b17bb8ab63480140dd7c271f94150027c996cea4efe83d3e3525e8f3eda22055f6a39220b
29582-
languageName: node
29583-
linkType: hard
29584-
2958529506
"use@npm:^3.1.0":
2958629507
version: 3.1.1
2958729508
resolution: "use@npm:3.1.1"

0 commit comments

Comments
 (0)