Skip to content

Commit

Permalink
fix(block): provide textual name on collapse and expansion to AT (#7652)
Browse files Browse the repository at this point in the history
**Related Issue:** #5565

## Summary
Prior to this proposed fix, NVDA and JAWS were only receiving context
that the `block` was expanded or collapsed due to the `title` prop.

Updates include:

- Adds an `aria-describedby` to provide context of the
collapse/expansion in addition to the header (handled via the `id`)
- Adds the `"header"` `id` to the block's `resources.ts`
  • Loading branch information
geospatialem authored Sep 1, 2023
1 parent 784cc25 commit 85bd71b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/calcite-components/src/components/block/block.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ export class Block
const toggleLabel = open ? messages.collapse : messages.expand;

const headerContent = (
<header class={CSS.header}>
<header class={CSS.header} id={IDS.header}>
{this.renderIcon()}
{this.renderTitle()}
</header>
Expand All @@ -295,6 +295,7 @@ export class Block
{collapsible ? (
<button
aria-controls={IDS.content}
aria-describedby={IDS.header}
aria-expanded={collapsible ? toAriaBoolean(open) : null}
class={CSS.toggle}
id={IDS.toggle}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const IDS = {
content: "content",
toggle: "toggle",
header: "header",
};

export const CSS = {
Expand Down

0 comments on commit 85bd71b

Please sign in to comment.