From: nsedrickm Date: Mon, 4 Jul 2022 15:14:17 +0000 (+0100) Subject: mgr/dashboard: Improve level A accessibility for datatable component X-Git-Tag: v18.0.0~169^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=020460cdec30adc7d4e12347db55f91d26d791bf;p=ceph.git mgr/dashboard: Improve level A accessibility for datatable component * Add accessible names for table action buttons, dropdowns and table input elements * Update accent color to primary color * Add custom row selection checkbox Fixes: https://tracker.ceph.com/issues/56022 Signed-off-by: nsedrickm --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html index 905aaa96b69b..ef2a4481dbe2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html @@ -5,11 +5,12 @@ class="btn btn-{{btnColor}}" [ngClass]="{'disabled': disableSelectionAction(currentAction)}" (click)="useClickAction(currentAction)" + [disabled]="disableSelectionAction(currentAction)" [routerLink]="useRouterLink(currentAction)" [attr.aria-label]="currentAction.name" [preserveFragment]="currentAction.preserveFragment ? '' : null"> - {{ currentAction.name }} + {{ currentAction.name }}
- @@ -63,13 +64,15 @@ -
@@ -80,7 +83,8 @@
-
@@ -128,7 +133,8 @@ @@ -177,6 +183,17 @@ [rowIdentity]="rowIdentity()" [rowHeight]="'auto'"> + + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.scss index 57b8e48de9cd..4762b301ff0d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.scss @@ -264,6 +264,10 @@ .cd-datatable-checkbox { text-align: center; + + &:checked { + accent-color: vv.$primary; + } } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index ddeda9ac4431..e9ff705fa648 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -69,6 +69,8 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O timeAgoTpl: TemplateRef; @ViewChild('rowDetailsTpl', { static: true }) rowDetailsTpl: TemplateRef; + @ViewChild('rowSelectionTpl', { static: true }) + rowSelectionTpl: TemplateRef; // This is the array with the items to be shown. @Input() @@ -407,9 +409,10 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O resizeable: false, sortable: false, draggable: false, - checkboxable: true, + checkboxable: false, canAutoResize: false, cellClass: 'cd-datatable-checkbox', + cellTemplate: this.rowSelectionTpl, width: 30 }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/styles/defaults/_bootstrap-defaults.scss b/src/pybind/mgr/dashboard/frontend/src/styles/defaults/_bootstrap-defaults.scss index d4a3d5f86bec..3f982c002b0f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/styles/defaults/_bootstrap-defaults.scss +++ b/src/pybind/mgr/dashboard/frontend/src/styles/defaults/_bootstrap-defaults.scss @@ -35,13 +35,14 @@ $dark: #777 !default; // Extra theme colors. $accent: $red !default; +$accent-wcag-aa-regular-text: #25828e !default; $warning-dark: $orange !default; $fg-color-over-dark-bg: $white !default; $fg-hover-color-over-dark-bg: $gray-500 !default; $theme-colors: ( - 'accent': $accent, + 'accent': $accent-wcag-aa-regular-text, 'warning-dark': $warning-dark ) !default;