From c75ed8fa695c68fa220341b383b7dfdec0f56a0f Mon Sep 17 00:00:00 2001 From: Leo <108552997+lpskdl@users.noreply.github.com> Date: Wed, 14 Dec 2022 14:28:44 +0100 Subject: [PATCH] Accessibility: Improved keyboard accessibility in BigValue (#59830) use appropriate elements when rendering BigValue --- .../src/components/BigValue/BigValue.tsx | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/packages/grafana-ui/src/components/BigValue/BigValue.tsx b/packages/grafana-ui/src/components/BigValue/BigValue.tsx index 7eca4c7b9857..c677484b79ad 100644 --- a/packages/grafana-ui/src/components/BigValue/BigValue.tsx +++ b/packages/grafana-ui/src/components/BigValue/BigValue.tsx @@ -1,9 +1,11 @@ +import { cx } from '@emotion/css'; import React, { PureComponent } from 'react'; import { DisplayValue, DisplayValueAlignmentFactors, FieldSparkline, VizOrientation } from '@grafana/data'; import { VizTextDisplayOptions } from '@grafana/schema'; import { Themeable2 } from '../../types'; +import { clearButtonStyles } from '../Button'; import { FormattedValueDisplay } from '../FormattedValueDisplay/FormattedValueDisplay'; import { buildLayout } from './BigValueLayout'; @@ -79,7 +81,7 @@ export class BigValue extends PureComponent { }; render() { - const { onClick, className, hasLinks } = this.props; + const { onClick, className, hasLinks, theme } = this.props; const layout = buildLayout(this.props); const panelStyles = layout.getPanelStyles(); const valueAndTitleContainerStyles = layout.getValueAndTitleContainerStyles(); @@ -90,14 +92,32 @@ export class BigValue extends PureComponent { // When there is an outer data link this tooltip will override the outer native tooltip const tooltip = hasLinks ? undefined : textValues.tooltip; + if (!onClick) { + return ( +
+
+ {textValues.title &&
{textValues.title}
} + +
+ {layout.renderChart()} +
+ ); + } + return ( -
+
+ ); } }