|
9 | 9 |
|
10 | 10 | import React, { memo, useMemo } from 'react'; |
11 | 11 | import { i18n } from '@kbn/i18n'; |
12 | | -import { EuiButtonIcon, useEuiTheme } from '@elastic/eui'; |
| 12 | +import { EuiButtonIcon, EuiToolTip, useEuiTheme } from '@elastic/eui'; |
13 | 13 | import type { Position } from '@elastic/charts'; |
14 | 14 | import { css } from '@emotion/react'; |
15 | 15 |
|
@@ -51,24 +51,30 @@ const LegendToggleComponent = ({ onClick, showLegend, legendPosition }: LegendTo |
51 | 51 | ); |
52 | 52 |
|
53 | 53 | return ( |
54 | | - // eslint-disable-next-line @elastic/eui/tooltip-button-icon-wrap -- absolute-positioned chart overlay; EuiToolTip wrapper alters snapshot rendering |
55 | | - <EuiButtonIcon |
56 | | - type="button" |
57 | | - iconType="listBullet" |
58 | | - color="text" |
59 | | - onClick={onClick} |
60 | | - css={[ |
61 | | - baseStyles, |
62 | | - showLegend ? isOpenStyle : null, |
63 | | - ['left', 'bottom'].includes(legendPosition) ? positionStyle : null, |
64 | | - ]} |
65 | | - aria-label={i18n.translate('charts.legend.toggleLegendButtonAriaLabel', { |
| 54 | + <EuiToolTip |
| 55 | + content={i18n.translate('charts.legend.toggleLegendButtonTitle', { |
66 | 56 | defaultMessage: 'Toggle legend', |
67 | 57 | })} |
68 | | - aria-expanded={showLegend} |
69 | | - isSelected={showLegend} |
70 | | - data-test-subj="vislibToggleLegend" |
71 | | - /> |
| 58 | + disableScreenReaderOutput |
| 59 | + > |
| 60 | + <EuiButtonIcon |
| 61 | + type="button" |
| 62 | + iconType="listBullet" |
| 63 | + color="text" |
| 64 | + onClick={onClick} |
| 65 | + css={[ |
| 66 | + baseStyles, |
| 67 | + showLegend ? isOpenStyle : null, |
| 68 | + ['left', 'bottom'].includes(legendPosition) ? positionStyle : null, |
| 69 | + ]} |
| 70 | + aria-label={i18n.translate('charts.legend.toggleLegendButtonAriaLabel', { |
| 71 | + defaultMessage: 'Toggle legend', |
| 72 | + })} |
| 73 | + aria-expanded={showLegend} |
| 74 | + isSelected={showLegend} |
| 75 | + data-test-subj="vislibToggleLegend" |
| 76 | + /> |
| 77 | + </EuiToolTip> |
72 | 78 | ); |
73 | 79 | }; |
74 | 80 |
|
|
0 commit comments