Skip to content

Commit

Permalink
Merge pull request #200 from bearfriend/d2l-table-role
Browse files Browse the repository at this point in the history
Fix a11y of d2l-table
  • Loading branch information
awikkerink authored Feb 20, 2019
2 parents 816c455 + 868fc4f commit 3de8bde
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
16 changes: 15 additions & 1 deletion d2l-scroll-wrapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ $_documentContainer.innerHTML = `<dom-module id="d2l-scroll-wrapper">
<d2l-table-circle-button class="right action" icon="[[endIcon]]" on-tap="handleTapRight" tabindex="-1" aria-hidden="true" type="button"></d2l-table-circle-button>
</d2l-sticky-element>
<div id="wrapper" class="wrapper">
<div class="inner-wrapper"><slot></slot></div>
<div class="inner-wrapper" role$="[[_role]]"><slot></slot></div>
</div>
</template>
Expand Down Expand Up @@ -360,6 +360,12 @@ Polymer({
type: Boolean,
reflectToAttribute: true
},

needsTable: {
type: Boolean,
value: false
},

/** IE and Edge requires the value to be 1 in some cases **/
/**
Background: In some occasions in IE and Edge, there is a
Expand All @@ -374,6 +380,10 @@ Polymer({
_stickyIsDisabled: {
type: Boolean,
computed: '_computeStickyIsDisabled(scrollbarLeft, scrollbarRight)'
},
_role: {
type: String,
computed: '_computeRole(needsTable)'
}
},

Expand Down Expand Up @@ -501,5 +511,9 @@ Polymer({

_computeStickyIsDisabled: function(scrollbarLeft, scrollbarRight) {
return Boolean(scrollbarLeft) && Boolean(scrollbarRight);
},

_computeRole: function(needsTable) {
return needsTable ? 'table' : null;
}
});
9 changes: 1 addition & 8 deletions d2l-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ $_documentContainer.innerHTML = `<dom-module id="d2l-table">
};
}
</style>
<d2l-scroll-wrapper show-actions="">
<d2l-scroll-wrapper show-actions="" needs-table>
<slot id="slot"></slot>
</d2l-scroll-wrapper>
</template>
Expand All @@ -177,13 +177,6 @@ Polymer({
listeners: {
'd2l-table-local-observer': '_handleLocalObserver'
},
properties: {
role: {
type: String,
value: 'table',
reflectToAttribute: true
}
},
__applyInQueue: false,
attached: function() {
afterNextRender(this, function() {
Expand Down

0 comments on commit 3de8bde

Please sign in to comment.