focusable-content-evaluate.js 506 B

1234567891011121314151617181920
  1. function focusableContentEvaluate(node, options, virtualNode) {
  2. /**
  3. * Note:
  4. * Check if given node contains focusable elements (excluding thyself)
  5. */
  6. const tabbableElements = virtualNode.tabbableElements;
  7. if (!tabbableElements) {
  8. return false;
  9. }
  10. // remove thyself from tabbable elements (if exists)
  11. const tabbableContentElements = tabbableElements.filter(
  12. el => el !== virtualNode
  13. );
  14. return tabbableContentElements.length > 0;
  15. }
  16. export default focusableContentEvaluate;