focusable-no-name-evaluate.js 475 B

123456789101112131415161718
  1. import { isFocusable } from '../../commons/dom';
  2. import { accessibleTextVirtual } from '../../commons/text';
  3. function focusableNoNameEvaluate(node, options, virtualNode) {
  4. const tabIndex = virtualNode.attr('tabindex');
  5. const inFocusOrder = isFocusable(virtualNode) && tabIndex > -1;
  6. if (!inFocusOrder) {
  7. return false;
  8. }
  9. try {
  10. return !accessibleTextVirtual(virtualNode);
  11. } catch (e) {
  12. return undefined;
  13. }
  14. }
  15. export default focusableNoNameEvaluate;