Skip to content
This repository has been archived by the owner on Dec 19, 2024. It is now read-only.

Commit

Permalink
fix test, add comment for supporting ShadowDom v1
Browse files Browse the repository at this point in the history
  • Loading branch information
valdrinkoshi committed Oct 26, 2016
1 parent 8b7f616 commit 1f4558a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion iron-focusables-helper.html
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@
result.push(element);
}

// In ShadowDOM v1, tab order is affected by the order of distrubution.
// E.g. getTabbableNodes(#root) in ShadowDOM v1 should return [#A, #B];
// in ShadowDOM v0 tab order is not affected by the distrubution order,
// in fact getTabbableNodes(#root) returns [#B, #A].
// <div id="root">
// <!-- shadow -->
// <slot name="a">
// <slot name="b">
// <!-- /shadow -->
// <input id="A" slot="a">
// <input id="B" slot="b" tabindex="1">
// </div>
// TODO(valdrin) support ShadowDOM v1 when upgrading to Polymer v2.0.
var children;
if (element.localName === 'content') {
children = Polymer.dom(element).getDistributedNodes();
Expand Down Expand Up @@ -185,7 +198,7 @@
},

/**
* Returns if an element has lower tab order compared to another element
* Returns if element `a` has lower tab order compared to element `b`
* (both elements are assumed to be focusable and tabbable).
* Elements with tabindex = 0 have lower tab order compared to elements
* with tabindex > 0.
Expand Down
2 changes: 1 addition & 1 deletion test/iron-overlay-behavior.html
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@ <h2>Focusables (with tabindex)</h2>

test('with-backdrop: after open, update last focusable node and then Shift+TAB', function(done) {
overlay.withBackdrop = true;
var focusableNodes = overlay._focusableNodes;
runAfterOpen(overlay, function() {
var focusableNodes = overlay._focusableNodes;
// 1ms timeout needed by IE10 to have proper focus switching.
Polymer.Base.async(function() {
// Before tabbing, make lastFocusable non-tabbable. This will make
Expand Down

0 comments on commit 1f4558a

Please sign in to comment.