Skip to content

Commit

Permalink
fix(ASSETS-5617): [Screen Readers-AEM Dynamic Media-Image Set Editor]…
Browse files Browse the repository at this point in the history
…: Screen readers are not narrating the descriptive information for the 'Swatches list items' which are present after 'Full Screen' button in the 'lmage Set Editor' page (#256)
  • Loading branch information
BogdanMare committed Feb 21, 2023
1 parent c54bff0 commit a128e83
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
7 changes: 7 additions & 0 deletions coral-component-steplist/src/scripts/StepList.js
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,13 @@ const StepList = Decorator(class extends BaseComponent(HTMLElement) {
this.setAttribute('aria-label', i18n.get('Step List'));
}

// the screen reader should not navigate to hidden element
// the element is hidden if has only one child
if (this.items.length === 1) {
this.setAttribute('aria-hidden', 'true');
this.interaction = StepList.interaction.OFF;
}

// Don't trigger events once connected
this._preventTriggeringEvents = true;
this._validateSelection();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<coral-steplist>
<coral-step>
<coral-step-label>Tab 1</coral-step-label>
</coral-step>
</coral-steplist>
14 changes: 14 additions & 0 deletions coral-component-steplist/src/tests/test.StepList.js
Original file line number Diff line number Diff line change
Expand Up @@ -812,4 +812,18 @@ describe('StepList', function () {
expect(trackData).to.have.property('rootType', 'coral-steplist');
});
});

describe('Accessibility', function () {
it('should have attribute aria-hidden set to true when has only one child', function () {
const el = helpers.build(window.__html__['StepList.onlyonechild.html']);
expect(el.items.length).to.equal(1);
expect(el.getAttribute('aria-hidden')).to.equal('true');
});

it('should not have attribute aria-hidden when has more than one child', function () {
const el = helpers.build(window.__html__['StepList.base.html']);
expect(el.items.length).to.equal(5);
expect(el.getAttribute('aria-hidden')).to.be.null;
});
});
});

0 comments on commit a128e83

Please sign in to comment.