focusable-modal-open-evaluate.js 447 B

1234567891011121314151617181920
  1. import { isModalOpen } from '../../commons/dom';
  2. function focusableModalOpenEvaluate(node, options, virtualNode) {
  3. const tabbableElements = virtualNode.tabbableElements.map(
  4. ({ actualNode }) => actualNode
  5. );
  6. if (!tabbableElements || !tabbableElements.length) {
  7. return true;
  8. }
  9. if (isModalOpen()) {
  10. this.relatedNodes(tabbableElements);
  11. return undefined;
  12. }
  13. return true;
  14. }
  15. export default focusableModalOpenEvaluate;