Skip to content

Commit

Permalink
fix(signpost): set aria-expanded on button during initial render (bac…
Browse files Browse the repository at this point in the history
…kport to main) (#1220)

Backport 6717669 from #1213. <br> ## PR
Checklist

Please check if your PR fulfills the following requirements:

- [x] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)
- [ ] If applicable, have a visual design approval

## PR Type

What kind of change does this PR introduce?

&lt;!-- Please check the one that applies to this PR using
&quot;x&quot;. --&gt;

- [x] Bugfix
- [ ] Feature
- [ ] Code style update (formatting, local variables)
- [ ] Refactoring (no functional changes, no api changes)
- [ ] Build related changes
- [ ] CI related changes
- [ ] Documentation content changes
- [ ] Other... Please describe:

## What is the current behavior?

The initial signpost trigger button is rendered without the
aria-expanded attribute, which is necessary for screen readers to
identify the button as having an expanded state.

Issue Number: CDE-1632

## What is the new behavior?
The initial render of the trigger button has the
aria-expanded=&quot;false&quot; attribute/value.

## Does this PR introduce a breaking change?

- [ ] Yes
- [X] No

&lt;!-- If this PR contains a breaking change, please describe the
impact and migration path for existing applications below. --&gt;

## Other information

Co-authored-by: Will Ernest <[email protected]>
  • Loading branch information
github-actions[bot] and williamernest authored Feb 9, 2024
1 parent 9104de2 commit 2cdbd53
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default function (): void {
});

it('reflects the correct aria-expanded state', () => {
expect(trigger.getAttribute('aria-expanded')).toBeFalsy();
expect(trigger.getAttribute('aria-expanded')).toBe('false');
trigger.click();
fixture.detectChanges();
expect(trigger.getAttribute('aria-expanded')).toBe('true');
Expand Down
2 changes: 1 addition & 1 deletion projects/angular/src/popover/signpost/signpost-trigger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import { SignpostIdService } from './providers/signpost-id.service';
*
*/
export class ClrSignpostTrigger implements OnDestroy {
ariaExpanded: boolean;
ariaExpanded = false;
ariaControl: string;
isOpen: boolean;

Expand Down

0 comments on commit 2cdbd53

Please sign in to comment.