From 993500aae48b923bb7cf9b095da53347cb5a0291 Mon Sep 17 00:00:00 2001 From: David Wheatley Date: Tue, 28 Dec 2021 21:08:34 +0100 Subject: [PATCH] fix(a11y): fix a11y warning in alert, and other a11y fixes (#3237) * fix(a11y): fix a11y warning in alert, and other a11y fixes * chore: correct import * chore: use `class` --- js/src/common/components/Alert.tsx | 17 +++++++++++++---- js/src/common/components/AlertManager.js | 21 ++++++++++++--------- locale/core.yml | 4 ++++ 3 files changed, 29 insertions(+), 13 deletions(-) diff --git a/js/src/common/components/Alert.tsx b/js/src/common/components/Alert.tsx index e206b591c..d9601b04e 100644 --- a/js/src/common/components/Alert.tsx +++ b/js/src/common/components/Alert.tsx @@ -3,6 +3,8 @@ import Button from './Button'; import listItems from '../helpers/listItems'; import extract from '../utils/extract'; import type Mithril from 'mithril'; +import classList from '../utils/classList'; +import app from '../app'; export interface AlertAttrs extends ComponentAttrs { /** The type of alert this is. Will be used to give the alert a class name of `Alert--{type}`. */ @@ -24,7 +26,7 @@ export default class Alert extends Component< const attrs = Object.assign({}, this.attrs); const type = extract(attrs, 'type'); - attrs.className = 'Alert Alert--' + type + ' ' + (attrs.className || ''); + attrs.className = classList('Alert', `Alert--${type}`, attrs.className); const content = extract(attrs, 'content') || vnode.children; const controls = (extract(attrs, 'controls') || []) as Mithril.Vnode[]; @@ -37,13 +39,20 @@ export default class Alert extends Component< const dismissControl: Mithril.Vnode[] = []; if (dismissible || dismissible === undefined) { - dismissControl.push(