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

react-focus-lock-wrapper.js 995B

123456789101112131415161718192021222324252627282930
  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 imposible 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. export default class FocusLockWrapper extends FocusLock<*> {
  10. /**
  11. * Implements React's {@link Component#render()}.
  12. *
  13. * @inheritdoc
  14. * @returns {ReactElement}
  15. */
  16. render() {
  17. const { children, ...otherProps } = this.props;
  18. const props = {
  19. ...otherProps,
  20. disabled: true
  21. };
  22. // MoveFocusInside is added in order to initially bring the focus on the dialog.
  23. return <FocusLock { ...props } ><MoveFocusInside>{children}</MoveFocusInside></FocusLock>;
  24. }
  25. }
  26. export * from 'react-focus-lock';