@@ -621,18 +621,27 @@ function focusNavigationHeuristics(spatnavPolyfillOptions) {
621621 * isFocusable :
622622 * Whether this element is focusable with spatnav.
623623 * check1. Whether the element is the browsing context (document, iframe)
624- * check2. The value of tabIndex is ">= 0"
625- * check3. Whether the element is disabled or not.
626- * check4. Whether the element is scrollable container or not. (regardless of scrollable axis)
624+ * check2. Whether the element is scrollable container or not. (regardless of scrollable axis)
625+ * check3. The value of tabIndex is ">= 0"
626+ * There are several elements which the tabindex focus flag be set:
627+ * (https://html.spec.whatwg.org/multipage/interaction.html#specially-focusable)
628+ * The element with tabindex=-1 is omitted from the spatial navigation order,
629+ * but, if there is a focusable child element, it will be included in the spatial navigation order.
630+ * check4. Whether the element is disabled or not.
631+ *
627632 * @function
628633 * @param {<Node> } element
629634 * @returns {Boolean }
630635 */
631636 function isFocusable ( element ) {
632- return ( ! element . parentElement ) ||
633- ( element . nodeName === 'IFRAME' ) ||
634- ( element . tabIndex >= 0 && ! element . disabled ) ||
635- ( isScrollable ( element ) && isOverflow ( element ) ) ;
637+ if ( ( element . tabIndex >= 0 && ! element . disabled ) ) {
638+ return ( ( element . nodeName === 'IFRAME' ) ||
639+ ! element . parentElement ) ||
640+ ( isScrollable ( element ) && isOverflow ( element ) ) ;
641+ }
642+ else {
643+ return false ;
644+ }
636645 }
637646
638647 /**
0 commit comments