diff --git a/superset-frontend/src/components/Chart/ChartErrorMessage.tsx b/superset-frontend/src/components/Chart/ChartErrorMessage.tsx index cd21275153f2..54c6e5117975 100644 --- a/superset-frontend/src/components/Chart/ChartErrorMessage.tsx +++ b/superset-frontend/src/components/Chart/ChartErrorMessage.tsx @@ -18,6 +18,7 @@ */ import { ClientErrorObject, SupersetError } from '@superset-ui/core'; +import { t } from '@apache-superset/core/translation'; import { FC } from 'react'; import { useChartOwnerNames } from 'src/hooks/apiResources'; import { ErrorMessageWithStackTrace } from 'src/components'; @@ -32,7 +33,7 @@ export type Props = { stackTrace?: string; } & Omit; -const DEFAULT_CHART_ERROR = 'Data error'; +const DEFAULT_CHART_ERROR = t('Error: Data error'); export const ChartErrorMessage: FC = ({ chartId, error, ...props }) => { // fetches the chart owners and adds them to the extra data of the error message diff --git a/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx b/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx index d95ec32ac38e..0e538052b30c 100644 --- a/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx +++ b/superset-frontend/src/components/ErrorMessage/ErrorAlert.test.tsx @@ -88,3 +88,46 @@ test('ErrorAlert renders compact mode with a tooltip and modal', () => { fireEvent.click(iconTrigger); expect(screen.getByText('Compact mode example')).toBeInTheDocument(); }); + +test('ErrorAlert renders an icon alongside the error text (non-color cue)', () => { + const { container } = render( + , + ); + // The Alert component with showIcon renders an antd icon element + const icon = container.querySelector('.ant-alert-icon'); + expect(icon).toBeInTheDocument(); +}); + +test('ErrorAlert renders a warning icon for warning type (non-color cue)', () => { + const { container } = render( + , + ); + // In compact mode, the renderTrigger function shows WarningOutlined for warnings + expect( + container.querySelector('[aria-label="warning"]'), + ).toBeInTheDocument(); +}); + +test('ErrorAlert renders an exclamation-circle icon for error type in compact mode (non-color cue)', () => { + const { container } = render( + , + ); + // In compact mode, the renderTrigger function shows ExclamationCircleOutlined for errors + expect( + container.querySelector('[aria-label="exclamation-circle"]'), + ).toBeInTheDocument(); +}); diff --git a/superset-frontend/src/components/ImportModal/ErrorAlert.tsx b/superset-frontend/src/components/ImportModal/ErrorAlert.tsx index 24551678c386..101267a15f08 100644 --- a/superset-frontend/src/components/ImportModal/ErrorAlert.tsx +++ b/superset-frontend/src/components/ImportModal/ErrorAlert.tsx @@ -44,7 +44,11 @@ export const ErrorAlert: FunctionComponent = ({ css={(theme: SupersetTheme) => antdWarningAlertStyles(theme)} type="error" showIcon - message={errorMessage} + message={ + <> + {t('Error:')} {errorMessage} + + } description={ showDbInstallInstructions ? ( <> diff --git a/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.test.tsx b/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.test.tsx index e851984fe069..79c99d4703f9 100644 --- a/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.test.tsx +++ b/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.test.tsx @@ -56,3 +56,17 @@ test('should render the colors', () => { const allColors = screen.getAllByTestId('color'); expect(allColors).toHaveLength(12); }); + +test('should render aria-label with scheme name on the swatch container', () => { + setup(); + const labelled = screen.getByLabelText('Color scheme: Superset Colors'); + expect(labelled).toBeInTheDocument(); +}); + +test('color swatches should be aria-hidden', () => { + setup(); + const allColors = screen.getAllByTestId('color'); + allColors.forEach(color => { + expect(color).toHaveAttribute('aria-hidden', 'true'); + }); +}); diff --git a/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.tsx b/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.tsx index 60e0a190916c..d2ee28d5ffac 100644 --- a/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.tsx +++ b/superset-frontend/src/explore/components/controls/ColorSchemeControl/ColorSchemeLabel.tsx @@ -18,6 +18,7 @@ */ import { css, SupersetTheme } from '@apache-superset/core/theme'; +import { t } from '@apache-superset/core/translation'; import { useRef, useState } from 'react'; import { Tooltip } from '@superset-ui/core/components'; @@ -55,6 +56,7 @@ export default function ColorSchemeLabel(props: ColorSchemeLabelProps) {