Skip to content

Commit 3628c84

Browse files
Fix Health Panel usability issues
- Fixed aria-controls on HealthComponentComponent, HealthInfoComponent, HealthInfoComponentComponent, HealthPanelComponent pointing to non-existing id - Fixed the tabs not having the role tab on its tabs - Fixed aria-expanded being set to true when collapsed and backwards for HealthPanelComponent & HealthInfoComponent - Fixed role="tablist" not having direct role="tab" by adding role="presentation" on the li elements - Fixed minor alignment issues
1 parent c300123 commit 3628c84

8 files changed

Lines changed: 40 additions & 30 deletions

File tree

src/app/health-page/health-info/health-info-component/health-info-component.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<div *ngFor="let entry of healthInfoComponent | dsObjNgFor" data-test="collapse">
22
<div *ngIf="entry && !isPlainProperty(entry.value)" class="mb-3 border-bottom">
3-
<div class="w-100 d-flex justify-content-between collapse-toggle" (click)="collapse.toggle()">
3+
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" (click)="collapse.toggle()">
44
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!collapse.collapsed"
5-
aria-controls="collapseExample">
5+
[attr.aria-controls]="'health-info-component-' + entry.key + '-content'">
66
{{ entry.key | titlecase }}
77
</button>
8-
<div class="d-inline-block">
8+
<div class="d-flex my-auto">
99
<span *ngIf="collapse.collapsed" class="fas fa-chevron-down"></span>
1010
<span *ngIf="!collapse.collapsed" class="fas fa-chevron-up"></span>
1111
</div>
1212
</div>
13-
<div #collapse="ngbCollapse" [ngbCollapse]="isCollapsed">
13+
<div #collapse="ngbCollapse" [id]="'health-info-component-' + entry.key + '-content'" [ngbCollapse]="isCollapsed">
1414
<div class="card border-0">
1515
<div class="card-body">
1616
<ds-health-info-component [healthInfoComponent]="entry.value"

src/app/health-page/health-info/health-info.component.html

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,24 @@
22
<ngb-accordion #acc="ngbAccordion" [activeIds]="activeId">
33
<ngb-panel [id]="entry.key" *ngFor="let entry of healthInfoResponse | dsObjNgFor">
44
<ng-template ngbPanelHeader>
5-
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="info-component">
6-
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded(entry.key)"
7-
aria-controls="collapsePanels">
5+
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="info-component">
6+
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="acc.isExpanded(entry.key)"
7+
[attr.aria-controls]="'health-info-' + entry.key + '-content'">
88
{{ getPanelLabel(entry.key) | titlecase }}
99
</button>
10-
<div class="text-right d-flex">
10+
<div class="text-right d-flex gap-2">
1111
<ds-health-status [status]="entry.value?.status"></ds-health-status>
12-
<div class="ml-3 d-inline-block">
12+
<div class="d-flex my-auto">
1313
<span *ngIf="acc.isExpanded(entry.key)" class="fas fa-chevron-up fa-fw"></span>
1414
<span *ngIf="!acc.isExpanded(entry.key)" class="fas fa-chevron-down fa-fw"></span>
1515
</div>
1616
</div>
1717
</div>
1818
</ng-template>
1919
<ng-template ngbPanelContent>
20-
<ds-health-info-component [healthInfoComponentName]="entry.key"
21-
[healthInfoComponent]="entry.value"></ds-health-info-component>
20+
<ds-health-info-component [healthInfoComponentName]="entry.key" [healthInfoComponent]="entry.value"
21+
[id]="'health-info-' + entry.key + '-content'">
22+
</ds-health-info-component>
2223
</ng-template>
2324
</ngb-panel>
2425
</ngb-accordion>

src/app/health-page/health-page.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
<h2>{{'health-page.heading' | translate}}</h2>
33
<div *ngIf="(healthResponse | async) && (healthInfoResponse | async)">
44
<ul ngbNav #nav="ngbNav" [activeId]="'status'" class="nav-tabs">
5-
<li [ngbNavItem]="'status'">
5+
<li [ngbNavItem]="'status'" role="presentation">
66
<a ngbNavLink>{{'health-page.status-tab' | translate}}</a>
77
<ng-template ngbNavContent>
88
<div id="status">
99
<ds-health-panel [healthResponse]="(healthResponse | async)"></ds-health-panel>
1010
</div>
1111
</ng-template>
1212
</li>
13-
<li [ngbNavItem]="'info'">
13+
<li [ngbNavItem]="'info'" role="presentation">
1414
<a ngbNavLink>{{'health-page.info-tab' | translate}}</a>
1515
<ng-template ngbNavContent>
1616
<div id="info">
@@ -21,7 +21,7 @@ <h2>{{'health-page.heading' | translate}}</h2>
2121
</ul>
2222
<div [ngbNavOutlet]="nav" class="mt-2"></div>
2323
</div>
24-
<ds-alert *ngIf="!(healthResponse | async) || !(healthInfoResponse | async)" [type]="'alert-danger'" [content]="'health-page.error.msg'"></ds-alert>
24+
<ds-alert *ngIf="!(healthResponse | async) || !(healthInfoResponse | async)" [type]="AlertType.Error" [content]="'health-page.error.msg'"></ds-alert>
2525
</div>
2626

2727

src/app/health-page/health-page.component.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { take } from 'rxjs/operators';
55

66
import { HealthService } from './health.service';
77
import { HealthInfoResponse, HealthResponse } from './models/health-component.model';
8+
import { AlertType } from '../shared/alert/alert-type';
89

910
@Component({
1011
selector: 'ds-health-page',
@@ -33,6 +34,8 @@ export class HealthPageComponent implements OnInit {
3334
*/
3435
healthInfoResponseInitialised: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
3536

37+
readonly AlertType = AlertType;
38+
3639
constructor(private healthDataService: HealthService) {
3740
}
3841

src/app/health-page/health-panel/health-component/health-component.component.html

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<ng-container *ngIf="healthComponent?.components">
22
<div *ngFor="let entry of healthComponent?.components | dsObjNgFor" class="mb-3 border-bottom" data-test="collapse">
3-
<div class="w-100 d-flex justify-content-between collapse-toggle" (click)="collapse.toggle()">
3+
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" (click)="collapse.toggle()">
44
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!collapse.collapsed"
5-
aria-controls="collapseExample">
5+
[attr.aria-controls]="'health-component-' + entry.key + 'content'">
66
{{ entry.key | titlecase }}
77
</button>
8-
<div class="d-inline-block">
8+
<div class="d-flex my-auto">
99
<span *ngIf="collapse.collapsed" class="fas fa-chevron-down"></span>
1010
<span *ngIf="!collapse.collapsed" class="fas fa-chevron-up"></span>
1111
</div>
1212
</div>
13-
<div #collapse="ngbCollapse" [ngbCollapse]="isCollapsed">
13+
<div #collapse="ngbCollapse" [id]="'health-component-' + entry.key + 'content'" [ngbCollapse]="isCollapsed">
1414
<div class="card border-0">
1515
<div class="card-body">
1616
<ds-health-component [healthComponent]="entry.value"

src/app/health-page/health-panel/health-panel.component.html

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
<p class="h4">{{'health-page.status' | translate}} : <ds-health-status [status]="healthResponse.status"></ds-health-status></p>
1+
<p class="h4">
2+
{{'health-page.status' | translate}}:
3+
<ds-health-status [status]="healthResponse.status" class="d-inline-flex"></ds-health-status>
4+
</p>
25
<ngb-accordion #acc="ngbAccordion" [activeIds]="activeId">
36
<ngb-panel [id]="entry.key" *ngFor="let entry of healthResponse.components | dsObjNgFor">
47
<ng-template ngbPanelHeader>
5-
<div class="w-100 d-flex justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="component">
6-
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="!acc.isExpanded(entry.key)"
7-
aria-controls="collapsePanels">
8+
<div class="w-100 d-flex gap-3 justify-content-between collapse-toggle" ngbPanelToggle (click)="acc.toggle(entry.key)" data-test="component">
9+
<button type="button" class="btn btn-link p-0" (click)="$event.preventDefault()" [attr.aria-expanded]="acc.isExpanded(entry.key)"
10+
[attr.aria-controls]="'health-panel-' + entry.key + '-content'">
811
{{ getPanelLabel(entry.key) | titlecase }}
912
</button>
10-
<div class="text-right d-flex">
13+
<div class="text-right d-flex gap-2">
1114
<ds-health-status [status]="entry.value?.status"></ds-health-status>
12-
<div class="ml-3 d-inline-block">
15+
<div class="d-flex my-auto">
1316
<span *ngIf="acc.isExpanded(entry.key)" class="fas fa-chevron-up fa-fw"></span>
1417
<span *ngIf="!acc.isExpanded(entry.key)" class="fas fa-chevron-down fa-fw"></span>
1518
</div>
1619
</div>
1720
</div>
1821
</ng-template>
1922
<ng-template ngbPanelContent>
20-
<ds-health-component [healthComponent]="entry.value" [healthComponentName]="entry.key"></ds-health-component>
23+
<ds-health-component [healthComponent]="entry.value" [healthComponentName]="entry.key"
24+
[id]="'health-panel-' + entry.key + '-content'" role="presentation">
25+
</ds-health-component>
2126
</ng-template>
2227
</ngb-panel>
2328
</ngb-accordion>
24-
25-
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<ng-container [ngSwitch]="status">
22
<i *ngSwitchCase="HealthStatus.UP"
3-
class="fa fa-check-circle text-success ml-2 mt-1"
3+
class="fa fa-check-circle text-success my-auto"
44
ngbTooltip="{{'health-page.status.ok.info' | translate}}" container="body" ></i>
55
<i *ngSwitchCase="HealthStatus.UP_WITH_ISSUES"
6-
class="fa fa-exclamation-triangle text-warning ml-2 mt-1"
6+
class="fa fa-exclamation-triangle text-warning my-auto"
77
ngbTooltip="{{'health-page.status.warning.info' | translate}}" container="body"></i>
88
<i *ngSwitchCase="HealthStatus.DOWN"
9-
class="fa fa-times-circle text-danger ml-2 mt-1"
9+
class="fa fa-times-circle text-danger my-auto"
1010
ngbTooltip="{{'health-page.status.error.info' | translate}}" container="body"></i>
1111

1212
</ng-container>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
:host {
2+
display: flex;
3+
}

0 commit comments

Comments
 (0)