@transferwise/components 0.0.0-experimental-e9526a8 → 0.0.0-experimental-d05d921
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/index.esm.js +12 -10
- package/build/index.esm.js.map +1 -1
- package/build/index.js +12 -10
- package/build/index.js.map +1 -1
- package/build/types/common/focusBoundary/FocusBoundary.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/common/bottomSheet/__snapshots__/BottomSheet.spec.tsx.snap +8 -8
- package/src/common/focusBoundary/FocusBoundary.tsx +11 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FocusBoundary.d.ts","sourceRoot":"","sources":["../../../../src/common/focusBoundary/FocusBoundary.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"FocusBoundary.d.ts","sourceRoot":"","sources":["../../../../src/common/focusBoundary/FocusBoundary.tsx"],"names":[],"mappings":";AAGA,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AAEF,QAAA,MAAM,aAAa,iBAAkB,kBAAkB,gCAatD,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/package.json
CHANGED
|
@@ -6,13 +6,13 @@ exports[`BottomSheet renders content when open 1`] = `
|
|
|
6
6
|
<div
|
|
7
7
|
class="np-theme-light"
|
|
8
8
|
>
|
|
9
|
-
<span
|
|
10
|
-
data-focus-scope-start="true"
|
|
11
|
-
hidden=""
|
|
12
|
-
/>
|
|
13
9
|
<div
|
|
14
10
|
tabindex="-1"
|
|
15
11
|
>
|
|
12
|
+
<span
|
|
13
|
+
data-focus-scope-start="true"
|
|
14
|
+
hidden=""
|
|
15
|
+
/>
|
|
16
16
|
<div
|
|
17
17
|
class="dimmer"
|
|
18
18
|
role="presentation"
|
|
@@ -66,11 +66,11 @@ exports[`BottomSheet renders content when open 1`] = `
|
|
|
66
66
|
</div>
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
69
|
+
<span
|
|
70
|
+
data-focus-scope-end="true"
|
|
71
|
+
hidden=""
|
|
72
|
+
/>
|
|
69
73
|
</div>
|
|
70
|
-
<span
|
|
71
|
-
data-focus-scope-end="true"
|
|
72
|
-
hidden=""
|
|
73
|
-
/>
|
|
74
74
|
</div>
|
|
75
75
|
</body>
|
|
76
76
|
`;
|
|
@@ -1,15 +1,22 @@
|
|
|
1
1
|
import { FocusScope } from '@react-aria/focus';
|
|
2
|
+
import { useEffect, useRef } from 'react';
|
|
2
3
|
|
|
3
4
|
type FocusBoundaryProps = {
|
|
4
5
|
children: React.ReactNode;
|
|
5
6
|
};
|
|
6
7
|
|
|
7
8
|
const FocusBoundary = ({ children }: FocusBoundaryProps) => {
|
|
9
|
+
const wrapperReference = useRef<HTMLDivElement>(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
wrapperReference.current?.focus({ preventScroll: true });
|
|
12
|
+
}, []);
|
|
13
|
+
|
|
8
14
|
return (
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
<div ref={wrapperReference} tabIndex={-1}>
|
|
16
|
+
<FocusScope contain restoreFocus>
|
|
17
|
+
{children}
|
|
18
|
+
</FocusScope>
|
|
19
|
+
</div>
|
|
13
20
|
);
|
|
14
21
|
};
|
|
15
22
|
|