From febc24522d006e14e1eb5bb57ebf4e71dda0a389 Mon Sep 17 00:00:00 2001 From: Kyle Cunningham Date: Wed, 19 Jan 2022 15:53:54 -0600 Subject: [PATCH] Accessibility Fixes for Several SQL Based Datasource Config Pages (#43982) * Add label elements for select boxes: MSSQL config * Add Permission level label * Add aria-label for password field * Fixes for Postgres a11y page * Fix whitespace error * Swap aria-labelby for "for" * Prefer "for" over aria-labeledby --- public/app/angular/angular_wrappers.ts | 1 + public/app/angular/services/ng_react.ts | 6 +++--- .../app/core/components/AccessControl/AddPermission.tsx | 1 + public/app/plugins/datasource/mssql/partials/config.html | 9 +++++---- public/app/plugins/datasource/mysql/partials/config.html | 1 + .../app/plugins/datasource/postgres/partials/config.html | 9 +++++---- 6 files changed, 16 insertions(+), 11 deletions(-) diff --git a/public/app/angular/angular_wrappers.ts b/public/app/angular/angular_wrappers.ts index 4747c83e977..e70b00537cc 100644 --- a/public/app/angular/angular_wrappers.ts +++ b/public/app/angular/angular_wrappers.ts @@ -134,6 +134,7 @@ export function registerAngularDirectives() { 'isConfigured', 'inputWidth', 'labelWidth', + 'aria-label', ['onReset', { watchDepth: 'reference', wrapApply: true }], ['onChange', { watchDepth: 'reference', wrapApply: true }], ]); diff --git a/public/app/angular/services/ng_react.ts b/public/app/angular/services/ng_react.ts index 3cf65f48708..3d87d7f0ab4 100644 --- a/public/app/angular/services/ng_react.ts +++ b/public/app/angular/services/ng_react.ts @@ -168,9 +168,9 @@ function getPropExpression(prop: any) { * @param attrs All attributes of the component. * @param propName Name of the prop that react component expects. */ -function findAttribute(attrs: string, propName: string): string { - const index = Object.keys(attrs).find((attr) => { - return attr.toLowerCase() === propName.toLowerCase() || attr.toLowerCase() === kebabCase(propName); +function findAttribute(attrs: object, propName: string): string { + const index = Object.keys(attrs).find((attr: any) => { + return attr.toLowerCase() === propName.toLowerCase() || kebabCase(attr) === kebabCase(propName); }); // @ts-ignore return attrs[index]; diff --git a/public/app/core/components/AccessControl/AddPermission.tsx b/public/app/core/components/AccessControl/AddPermission.tsx index ac71e368650..b2da564b1fe 100644 --- a/public/app/core/components/AccessControl/AddPermission.tsx +++ b/public/app/core/components/AccessControl/AddPermission.tsx @@ -92,6 +92,7 @@ export const AddPermission = ({ )} +