diff --git a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/actions_menu.tsx b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/actions_menu.tsx index d85bb4ac27c7e..08c28d5481054 100644 --- a/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/actions_menu.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/applications/fleet/sections/agent_policy/components/actions_menu.tsx @@ -7,6 +7,7 @@ import React, { memo, useState, useMemo, useCallback } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; import { EuiContextMenuItem, EuiPortal } from '@elastic/eui'; import type { AgentPolicy } from '../../../types'; @@ -88,6 +89,13 @@ export const AgentPolicyActionMenu = memo<{ } }, [onCancelEnrollment, setIsEnrollmentFlyoutOpen]); + const actionsAriaLabel = fullButton + ? undefined + : i18n.translate('xpack.fleet.agentPolicyActionMenu.actionsAriaLabel', { + defaultMessage: 'Actions for {policyName}', + values: { policyName: agentPolicy.name }, + }); + return ( {(copyAgentPolicyPrompt) => { @@ -350,6 +358,7 @@ export const AgentPolicyActionMenu = memo<{ (({ datastre const { dashboards } = datastream; const dashboardLocator = useDashboardLocator(); + const actionsAriaLabel = i18n.translate('xpack.fleet.dataStreamList.rowActionsAriaLabel', { + defaultMessage: 'Actions for {dataset}', + values: { dataset: datastream.dataset }, + }); + const actionNameSingular = ( (({ datastre ], }, ]; - return ; + return ; } if (!dashboards || dashboards.length === 0) { @@ -74,7 +79,7 @@ export const DataStreamRowActions = memo<{ datastream: DataStream }>(({ datastre ], }, ]; - return ; + return ; } if (dashboards.length === 1) { @@ -91,7 +96,7 @@ export const DataStreamRowActions = memo<{ datastream: DataStream }>(({ datastre ], }, ]; - return ; + return ; } const panelItems = [ @@ -119,5 +124,5 @@ export const DataStreamRowActions = memo<{ datastream: DataStream }>(({ datastre }, ]; - return ; + return ; }); diff --git a/x-pack/platform/plugins/shared/fleet/public/components/context_menu_actions.tsx b/x-pack/platform/plugins/shared/fleet/public/components/context_menu_actions.tsx index 5680a0e1986dc..56b36a4b2e3e0 100644 --- a/x-pack/platform/plugins/shared/fleet/public/components/context_menu_actions.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/components/context_menu_actions.tsx @@ -27,6 +27,7 @@ type Props = { isOpen?: boolean; isManaged?: boolean; onChange?: (isOpen: boolean) => void; + 'aria-label'?: string; } & ( | { items: EuiContextMenuPanelProps['items']; @@ -36,64 +37,69 @@ type Props = { } ); -export const ContextMenuActions = React.memo(({ button, onChange, isOpen, ...props }) => { - const [isOpenState, setIsOpenState] = useState(false); - const handleCloseMenu = useCallback(() => { - if (onChange) { - onChange(false); - } else { - setIsOpenState(false); - } - }, [setIsOpenState, onChange]); - const handleToggleMenu = useCallback(() => { - if (onChange) { - onChange(!isOpen); - } else { - setIsOpenState(!isOpenState); - } - }, [isOpenState, onChange, isOpen]); +export const ContextMenuActions = React.memo( + ({ button, onChange, isOpen, 'aria-label': ariaLabel, ...props }) => { + const [isOpenState, setIsOpenState] = useState(false); + const handleCloseMenu = useCallback(() => { + if (onChange) { + onChange(false); + } else { + setIsOpenState(false); + } + }, [setIsOpenState, onChange]); + const handleToggleMenu = useCallback(() => { + if (onChange) { + onChange(!isOpen); + } else { + setIsOpenState(!isOpenState); + } + }, [isOpenState, onChange, isOpen]); - const actionButton = button ? ( - - {button.children} - - ) : ( - - ); + const actionButton = button ? ( + + {button.children} + + ) : ( + + ); - return ( - - {actionButton} - + return ( + + {actionButton} + + ) : ( + actionButton + ) + } + isOpen={isOpen === undefined ? isOpenState : isOpen} + closePopover={handleCloseMenu} + > + {'items' in props ? ( + ) : ( - actionButton - ) - } - isOpen={isOpen === undefined ? isOpenState : isOpen} - closePopover={handleCloseMenu} - > - {'items' in props ? ( - - ) : ( - - )} - - ); -}); + + )} + + ); + } +); diff --git a/x-pack/platform/plugins/shared/fleet/public/components/package_policy_actions_menu.tsx b/x-pack/platform/plugins/shared/fleet/public/components/package_policy_actions_menu.tsx index e23581502803c..e7ba1b87a8a98 100644 --- a/x-pack/platform/plugins/shared/fleet/public/components/package_policy_actions_menu.tsx +++ b/x-pack/platform/plugins/shared/fleet/public/components/package_policy_actions_menu.tsx @@ -8,6 +8,7 @@ import React, { useMemo, useState } from 'react'; import { EuiContextMenuItem, EuiPortal } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; +import { i18n } from '@kbn/i18n'; import { EXCLUDED_FROM_PACKAGE_POLICY_COPY_PACKAGES } from '../../common/constants'; import type { AgentPolicy, InMemoryPackagePolicy } from '../types'; @@ -250,6 +251,10 @@ export const PackagePolicyActionsMenu: React.FunctionComponent<{ isOpen={isActionsMenuOpen} items={menuItems} onChange={(open) => setIsActionsMenuOpen(open)} + aria-label={i18n.translate('xpack.fleet.packagePolicyActionsMenu.actionsAriaLabel', { + defaultMessage: 'Actions for {policyName}', + values: { policyName: packagePolicy.name }, + })} /> );