|
@@ -6,31 +6,26 @@ import FocusLock, { MoveFocusInside } from 'react-focus-lock';
|
6
|
6
|
* FocusLock wrapper that disable the FocusLock in the @atlaskit/modal-dialog. We need to disable it because if the
|
7
|
7
|
* iframe API is used and a dialog is displayed it is impossible to click on fields outside of the iframe (FocusLock
|
8
|
8
|
* will steal the focus from any element that is not part of the dialog).
|
|
9
|
+ *
|
|
10
|
+ * @param {Object} props - The props passed to the FocusLock.
|
|
11
|
+ * @returns {ReactElement}
|
9
|
12
|
*/
|
10
|
|
-export default class FocusLockWrapper extends FocusLock<*> {
|
11
|
|
- /**
|
12
|
|
- * Implements React's {@link Component#render()}.
|
13
|
|
- *
|
14
|
|
- * @inheritdoc
|
15
|
|
- * @returns {ReactElement}
|
16
|
|
- */
|
17
|
|
- render() {
|
18
|
|
- const { children, ...otherProps } = this.props;
|
|
13
|
+export default (props: Object) => {
|
|
14
|
+ const { children, ...otherProps } = props;
|
19
|
15
|
|
20
|
|
- const props = {
|
21
|
|
- ...otherProps,
|
22
|
|
- crossFrame: false
|
23
|
|
- };
|
|
16
|
+ const forwardProps = {
|
|
17
|
+ ...otherProps,
|
|
18
|
+ crossFrame: false
|
|
19
|
+ };
|
24
|
20
|
|
25
|
|
- // MoveFocusInside is added in order to initially bring the focus on the dialog.
|
26
|
|
- return (
|
27
|
|
- <FocusLock
|
28
|
|
- { ...props }
|
29
|
|
- className = 'focus-lock'>
|
30
|
|
- <MoveFocusInside>{children}</MoveFocusInside>
|
31
|
|
- </FocusLock>
|
32
|
|
- );
|
33
|
|
- }
|
34
|
|
-}
|
|
21
|
+ // MoveFocusInside is added in order to initially bring the focus on the dialog.
|
|
22
|
+ return (
|
|
23
|
+ <FocusLock
|
|
24
|
+ { ...forwardProps }
|
|
25
|
+ className = 'focus-lock'>
|
|
26
|
+ <MoveFocusInside>{children}</MoveFocusInside>
|
|
27
|
+ </FocusLock>
|
|
28
|
+ );
|
|
29
|
+};
|
35
|
30
|
|
36
|
31
|
export * from 'react-focus-lock';
|