Content.js

  1. import React from 'react';
  2. import PropTypes from 'prop-types';
  3. export default class Content extends React.Component {
  4. static propTypes = {
  5. prefixCls: PropTypes.string,
  6. overlay: PropTypes.oneOfType([
  7. PropTypes.node,
  8. PropTypes.func,
  9. ]).isRequired,
  10. id: PropTypes.string,
  11. trigger: PropTypes.any,
  12. }
  13. componentDidUpdate() {
  14. const { trigger } = this.props;
  15. if (trigger) {
  16. trigger.forcePopupAlign();
  17. }
  18. }
  19. render() {
  20. const { overlay, prefixCls, id } = this.props;
  21. return (
  22. <div className={`${prefixCls}-inner`} id={id} role="tooltip">
  23. {typeof overlay === 'function' ? overlay() : overlay}
  24. </div>
  25. );
  26. }
  27. }

role:
Accessible Rich Internet Applications (ARIA): https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA