您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

react-focus-lock-wrapper.js 986B

12345678910111213141516171819202122232425262728293031
  1. // @flow
  2. import React from 'react';
  3. import FocusLock, { MoveFocusInside } from 'react-focus-lock';
  4. /**
  5. * FocusLock wrapper that disable the FocusLock in the @atlaskit/modal-dialog. We need to disable it because if the
  6. * iframe API is used and a dialog is displayed it is impossible to click on fields outside of the iframe (FocusLock
  7. * will steal the focus from any element that is not part of the dialog).
  8. *
  9. * @param {Object} props - The props passed to the FocusLock.
  10. * @returns {ReactElement}
  11. */
  12. export default (props: Object) => {
  13. const { children, ...otherProps } = props;
  14. const forwardProps = {
  15. ...otherProps,
  16. crossFrame: false
  17. };
  18. // MoveFocusInside is added in order to initially bring the focus on the dialog.
  19. return (
  20. <FocusLock
  21. { ...forwardProps }
  22. className = 'focus-lock'>
  23. <MoveFocusInside>{children}</MoveFocusInside>
  24. </FocusLock>
  25. );
  26. };
  27. export * from 'react-focus-lock';