Skip to content

Commit

Permalink
fix(card): add aria-hide to card-copy (carbon-design-system#5019)
Browse files Browse the repository at this point in the history
### Related Ticket(s)
carbon-design-system#4740 

### Description

Follow-up to carbon-design-system#4870 to also hide the `card-copy` text from screen readers to avoid unnecessary long description.

### Changelog

**New**

- added `aria-hidden='true'` to `card-copy` div

<!-- 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
IgnacioBecerra committed Feb 22, 2021
1 parent 193df1e commit 83a0764
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/web-components/src/components/card/card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class DDSCard extends StableSelectorMixin(BXLink) {
protected _renderCopy(): TemplateResult | string | void {
const { _hasCopy: hasCopy } = this;
return html`
<div ?hidden="${!hasCopy}" class="${prefix}--card__copy">
<div ?hidden="${!hasCopy}" class="${prefix}--card__copy" aria-hidden="true">
<slot @slotchange="${this._handleSlotChange}"></slot>
</div>
`;
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/tests/snapshots/dds-card-cta.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<slot name="heading">
</slot>
<div
aria-hidden="true"
class="bx--card__copy"
hidden=""
>
Expand Down
2 changes: 2 additions & 0 deletions packages/web-components/tests/snapshots/dds-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<slot name="heading">
</slot>
<div
aria-hidden="true"
class="bx--card__copy"
hidden=""
>
Expand Down Expand Up @@ -49,6 +50,7 @@
<slot name="heading">
</slot>
<div
aria-hidden="true"
class="bx--card__copy"
hidden=""
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<slot name="heading">
</slot>
<div
aria-hidden="true"
class="bx--card__copy"
hidden=""
>
Expand Down Expand Up @@ -58,6 +59,7 @@
<slot name="heading">
</slot>
<div
aria-hidden="true"
class="bx--card__copy"
hidden=""
>
Expand Down
2 changes: 2 additions & 0 deletions packages/web-components/tests/snapshots/dds-feature-card.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<slot name="heading">
</slot>
<div
aria-hidden="true"
class="bx--card__copy"
hidden=""
>
Expand Down Expand Up @@ -55,6 +56,7 @@
<slot name="heading">
</slot>
<div
aria-hidden="true"
class="bx--card__copy"
hidden=""
>
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/tests/snapshots/dds-feature-cta.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<slot name="heading">
</slot>
<div
aria-hidden="true"
class="bx--card__copy"
hidden=""
>
Expand Down

0 comments on commit 83a0764

Please sign in to comment.