[A11y][APM] Add aria-label to "Try our new inventory" button (#215633)

## Summary

Fixes #210253

This PR adds an `aria-label` with the same content as the tooltip to
solve the "Button must have a discernible text" A11y critical issue.

## How to test
1. Download the [axe
devtools](https://chromewebstore.google.com/detail/axe-devtools-web-accessib/lhdoppojpmngadmnindnejefpokejbdd)
2. Enable ECO feature flag
3. Go into service inventory and run the scanner from axe devtools
4. You should see a critical error
5. Checkout this branch
6. Error should be solved

---------

Co-authored-by: Carlos Crespo <crespocarlos@users.noreply.github.com>
This commit is contained in:
Sergi Romeu 2025-03-24 17:12:15 +01:00 committed by GitHub
parent 1c738f6e13
commit 7512aa30fa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@
import { EuiFlexGroup, EuiFlexItem, EuiLink, EuiToolTip, EuiButtonIcon } from '@elastic/eui';
import { TechnicalPreviewBadge } from '@kbn/observability-shared-plugin/public';
import React from 'react';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';
import { useKibana } from '@kbn/kibana-react-plugin/public';
import type { ApmPluginStartDeps } from '../../../../plugin';
@ -49,6 +50,9 @@ export function EntitiesInventoryCallout({ onDismiss }: EntitiesInventoryCallout
>
<EuiButtonIcon
data-test-subj="apmEntitiesInventoryCalloutDismiss"
aria-label={i18n.translate('xpack.apm.entitiesInventoryCallout.ariaLabel', {
defaultMessage: 'Hide the entities inventory callout',
})}
iconType="cross"
onClick={onDismiss}
/>