mirror of
https://github.com/Unleash/unleash.git
synced 2025-02-09 00:18:00 +01:00
fix: improve feature metrics accessibility (#901)
* refactor: fix header order * refactor: improve metrics chart aria attributes * refactor: add focus style for active metrics chips
This commit is contained in:
parent
ffa91a3758
commit
3bb5a69d86
@ -13,10 +13,10 @@ import {
|
|||||||
Tooltip,
|
Tooltip,
|
||||||
} from 'chart.js';
|
} from 'chart.js';
|
||||||
import { useLocationSettings } from 'hooks/useLocationSettings';
|
import { useLocationSettings } from 'hooks/useLocationSettings';
|
||||||
import { FEATURE_METRICS_TABLE_ID } from '../FeatureMetricsTable/FeatureMetricsTable';
|
|
||||||
import 'chartjs-adapter-date-fns';
|
import 'chartjs-adapter-date-fns';
|
||||||
import { createChartData } from './createChartData';
|
import { createChartData } from './createChartData';
|
||||||
import { createChartOptions } from './createChartOptions';
|
import { createChartOptions } from './createChartOptions';
|
||||||
|
import { FEATURE_METRICS_STATS_ID } from '../FeatureMetricsStats/FeatureMetricsStats';
|
||||||
|
|
||||||
interface IFeatureMetricsChartProps {
|
interface IFeatureMetricsChartProps {
|
||||||
metrics: IFeatureMetricsRaw[];
|
metrics: IFeatureMetricsRaw[];
|
||||||
@ -48,8 +48,8 @@ export const FeatureMetricsChart = ({
|
|||||||
<Line
|
<Line
|
||||||
options={options}
|
options={options}
|
||||||
data={data}
|
data={data}
|
||||||
aria-label="A line chart with series for all requests, positive requests, and negative requests."
|
aria-label="A feature metrics line chart, with three lines: all requests, positive requests, and negative requests."
|
||||||
aria-describedby={FEATURE_METRICS_TABLE_ID}
|
aria-describedby={FEATURE_METRICS_STATS_ID}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -21,5 +21,12 @@ export const useStyles = makeStyles(theme => ({
|
|||||||
backgroundColor: theme.palette.primary.main,
|
backgroundColor: theme.palette.primary.main,
|
||||||
color: theme.palette.primary.contrastText,
|
color: theme.palette.primary.contrastText,
|
||||||
},
|
},
|
||||||
|
'& > :is(:focus-visible, :active)': {
|
||||||
|
outline: 0,
|
||||||
|
outlineStyle: 'solid',
|
||||||
|
outlineWidth: 2,
|
||||||
|
outlineOffset: 2,
|
||||||
|
outlineColor: theme.palette.primary.main,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
@ -31,7 +31,7 @@ export const FeatureMetricsChips = ({
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h3 className={styles.title}>{title}</h3>
|
<h2 className={styles.title}>{title}</h2>
|
||||||
<ul className={styles.list}>
|
<ul className={styles.list}>
|
||||||
{sortedValues.map(val => (
|
{sortedValues.map(val => (
|
||||||
<li key={val} className={styles.item}>
|
<li key={val} className={styles.item}>
|
||||||
|
@ -8,6 +8,8 @@ interface IFeatureMetricsStatsProps {
|
|||||||
hoursBack: number;
|
hoursBack: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const FEATURE_METRICS_STATS_ID = 'feature-metrics-stats-id';
|
||||||
|
|
||||||
export const FeatureMetricsStats = ({
|
export const FeatureMetricsStats = ({
|
||||||
totalYes,
|
totalYes,
|
||||||
totalNo,
|
totalNo,
|
||||||
@ -19,7 +21,13 @@ export const FeatureMetricsStats = ({
|
|||||||
hoursBack === 1 ? 'in the last hour' : `in the last ${hoursBack} hours`;
|
hoursBack === 1 ? 'in the last hour' : `in the last ${hoursBack} hours`;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Grid container spacing={2}>
|
<Grid
|
||||||
|
container
|
||||||
|
spacing={2}
|
||||||
|
id={FEATURE_METRICS_STATS_ID}
|
||||||
|
aria-label="Feature metrics summary"
|
||||||
|
component="section"
|
||||||
|
>
|
||||||
<Grid item xs={12} sm={4}>
|
<Grid item xs={12} sm={4}>
|
||||||
<article className={styles.item}>
|
<article className={styles.item}>
|
||||||
<h3 className={styles.title}>Exposure</h3>
|
<h3 className={styles.title}>Exposure</h3>
|
||||||
|
@ -34,7 +34,7 @@ export const FeatureMetricsTable = ({ metrics }: IFeatureMetricsTableProps) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Table id={FEATURE_METRICS_TABLE_ID}>
|
<Table id={FEATURE_METRICS_TABLE_ID} aria-label="Feature metrics table">
|
||||||
<TableHead>
|
<TableHead>
|
||||||
<TableRow>
|
<TableRow>
|
||||||
<TableCell>Time</TableCell>
|
<TableCell>Time</TableCell>
|
||||||
|
Loading…
Reference in New Issue
Block a user