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

Commit

Permalink
Bandaid Ember 3.1.0-beta.1 role attribute binding changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nbibler committed Mar 16, 2018
1 parent 1b765a7 commit 85b2de8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ See [changes since release][HEAD].
* Add "aria-live" to tablists for reporting tab changes to the user.
* Add optional "aria-label" to tablists to improve screenreader reporting.
* Give active tabpanels tabindex 0 to allow keyboard navigation to the active panel content.
* Use a temporary "presentation" role for tablists until tabs are inserted and the "tablist" role is then allowed. See emberjs/ember.js#16379.

## [3.2.0][] / 2018-03-07

Expand Down
6 changes: 6 additions & 0 deletions addon/components/ivy-tabs-tablist.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@ export default Component.extend({
ariaRole: computed('isEmpty', function() {
if (!this.get('isEmpty')) {
return 'tablist';
} else {
// FIXME: Ember 3.1.0-beta.1 introduced a bug which does not bind/watch
// ariaRole changes if it's initially falsy. This sets a non-falsy,
// "safe" value for ariaRole until it can be a "tablist" when Tabs are
// added.
return 'presentation';
}
}).readOnly(),

Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance/dynamic-tabs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module('Acceptance | dynamic tabs', function(hooks) {

const tablist = find('#dynamic-tablist');
assert.equal(tablist.getAttribute('aria-multiselectable'), null);
assert.equal(tablist.getAttribute('role'), null);
assert.equal(tablist.getAttribute('role'), 'presentation');

await click(findButtonByText('Add an Item'));

Expand All @@ -21,7 +21,7 @@ module('Acceptance | dynamic tabs', function(hooks) {
await click(findTab('Item 1').querySelector('.close'));

assert.equal(tablist.getAttribute('aria-multiselectable'), null);
assert.equal(tablist.getAttribute('role'), null);
assert.equal(tablist.getAttribute('role'), 'presentation');
});

test('the first tab added should be selected', async function(assert) {
Expand Down

0 comments on commit 85b2de8

Please sign in to comment.