Skip to content

Commit

Permalink
fix(comparision-table): improve toggle section screen reader output(#…
Browse files Browse the repository at this point in the history
…1063)
  • Loading branch information
vt-allianz authored and GitHub Enterprise committed Nov 16, 2023
1 parent 0f44626 commit f435eb0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,11 @@
>
</nx-comparison-table-desktop-group>

<!-- add role=table here to prevent screen reader wrong reading. since toggleSection is like another table, -->
<div role="table" *ngIf="_isToggleSection(element)" class="nx-comparison-table__toggle-section">
<div *ngIf="_isToggleSection(element)" class="nx-comparison-table__toggle-section">
<div class="nx-comparison-table__toggle-section-header" role="row">
<ng-container *ngTemplateOutlet="element.toggleSectionHeader._content"></ng-container>
<div>
<ng-container *ngTemplateOutlet="element.toggleSectionHeader._content"></ng-container>
</div>
</div>

<div class="nx-comparison-table__toggle-section-body" [@bodyExpansion]="element.getOpenState()" role="rowgroup">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div
#wrapper
class="nx-comparison-table-toggle-section__header-wrapper"
role="columnheader"
role="rowheader"
[attr.aria-colspan]="_table.viewType === 'desktop' ? _table._getHeaderCells().length + 1 : _table._getHeaderCells().length"
[attr.aria-expanded]="_toggleSection.isExpanded"
[attr.id]="id"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ describe('ToggleSectionHeaderComponent', () => {
tick(THROTTLE_TIME);
expect(headerElements[0].attributes.role).toBe('row');
const wrapper = headerElements[0].nativeElement.querySelector('.nx-comparison-table-toggle-section__header-wrapper') as HTMLElement;
expect(wrapper.getAttribute('role')).toBe('columnheader');
expect(wrapper.getAttribute('role')).toBe('rowheader');
expect(wrapper.getAttribute('aria-colspan')).toBe('2');
}));

Expand Down

0 comments on commit f435eb0

Please sign in to comment.