Skip to content

Commit

Permalink
TableData is focusable element for now (closes #901) (#909)
Browse files Browse the repository at this point in the history
  • Loading branch information
georgiy-abbasov authored and churkin committed Nov 3, 2016
1 parent b2824f7 commit 8b8dc42
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/client/utils/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,9 @@ export function isElementFocusable (el) {
matches(el, 'a[href]');
}

if (isTableDataElement(el) && isIE)
return true;

return matches(el, getFocusableSelector()) || tabIndex !== null;
}

Expand Down Expand Up @@ -637,6 +640,10 @@ export function isTableElement (el) {
return getTagName(el) === 'table';
}

export function isTableDataElement (el) {
return getTagName(el) === 'td';
}

export function matches (el, selector) {
if (!el)
return false;
Expand Down
9 changes: 9 additions & 0 deletions test/client/data/is-focusable/iframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,14 @@
<input type="button" value="button input" tabindex="-1" class="expected"/>

<iframe class="expected"></iframe>
<table>
<tbody>
<tr>
<td class="expected">
Table data
</td>
</tr>
</tbody>
</table>
</body>
</html>
5 changes: 5 additions & 0 deletions test/client/fixtures/utils/dom-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,11 @@ asyncTest('isElementFocusable', function () {
return !domUtils.isOptionElement(el);
});
}
else {
expectedFocusedElements = expectedFocusedElements.filter(function (el) {
return !domUtils.isTableDataElement(el);
});
}

for (var i = 0; i < allElements.length; i++) {
if (domUtils.isElementFocusable(allElements[i]))
Expand Down

0 comments on commit 8b8dc42

Please sign in to comment.