Skip to content

Commit

Permalink
fix(linkList): add aria attribute to item-card (#5010)
Browse files Browse the repository at this point in the history
### Related Ticket(s)

#4060 

### Description

To provide each link-list-item-card with a landmark region and appropriate label to convey beginning and ending boundary for the screen reader user. 

### Changelog

**New**

- `aria-label` attribute

**Changed**

- `role` to using `region`

<!-- React and Web Component deploy previews are enabled by default. -->
<!-- To enable additional available deploy previews, apply the following -->
<!-- labels for the corresponding package: -->
<!-- *** "package: services": Services -->
<!-- *** "package: utilities": Utilities -->
<!-- *** "package: styles": Carbon Expressive -->
<!-- *** "RTL": React / Web Components (RTL) -->
<!-- *** "feature flag": React / Web Components (experimental) -->
  • Loading branch information
ariellalgilmore authored Jan 29, 2021
1 parent c2d8d13 commit 09ea8d8
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* @license
*
* Copyright IBM Corp. 2020
* Copyright IBM Corp. 2020, 2021
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
Expand All @@ -23,7 +23,10 @@ const { stablePrefix: ddsPrefix } = ddsSettings;
class DDSLinkListItem extends DDSCardLink {
connectedCallback() {
if (!this.hasAttribute('role')) {
this.setAttribute('role', 'listitem');
this.setAttribute('role', 'region');
}
if (this.innerText) {
this.setAttribute('aria-label', this.innerText);
}
super.connectedCallback();
}
Expand Down

0 comments on commit 09ea8d8

Please sign in to comment.