From 791aff08e454f87199572e03b884eefd6cd0b116 Mon Sep 17 00:00:00 2001 From: Alexey Antonov Date: Wed, 11 Dec 2024 18:52:17 +0200 Subject: [PATCH] fix: [Search:WorkplaceSearch:API keys page]API key page modal dialog, flyout missing title from announcement (#202716) Closes: #201570 **Description** Dialog modal, flyout visible title should be announced for the users, especially using assistive technology to know what dialog modal, flyout opened. **Preconditions** Stateful Workplace Search -> API keys page is opened. Use Screen Reader (NVDA). **Steps to reproduce** 1.Using only keyboard navigate to Create key button by pressing Tab key. 2.Press Enter. 3.Observe screen reader. 4.Close the flyout. 5.Navigate to Delete button. 6.Press Enter. 7.Observe screen reader. ## Changes made: 1. aria-labelledby={modalTitleId} attribute was added for mentioned EuiModal ## Screen: image image --- .../add_analytics_collection_modal.tsx | 6 +++++- .../api_keys/components/api_key_flyout.tsx | 19 ++++++++++++++++--- .../api_keys/components/api_keys_list.tsx | 11 ++++++++++- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/x-pack/plugins/enterprise_search/public/applications/analytics/components/add_analytics_collections/add_analytics_collection_modal.tsx b/x-pack/plugins/enterprise_search/public/applications/analytics/components/add_analytics_collections/add_analytics_collection_modal.tsx index c907ab326c774..6008c391239ba 100644 --- a/x-pack/plugins/enterprise_search/public/applications/analytics/components/add_analytics_collections/add_analytics_collection_modal.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/analytics/components/add_analytics_collections/add_analytics_collection_modal.tsx @@ -83,13 +83,17 @@ export const AddAnalyticsCollectionModal: React.FC - + {i18n.translate('xpack.enterpriseSearch.analytics.collectionsCreate.form.cancelButton', { defaultMessage: 'Cancel', })} { activeApiTokenRawName: rawName, } = useValues(ApiKeysLogic); + const flyoutTitleId = useGeneratedHtmlId(); + return ( - + -

{API_KEY_FLYOUT_TITLE}

+

{API_KEY_FLYOUT_TITLE}

@@ -86,7 +95,11 @@ export const ApiKeyFlyout: React.FC = () => { - + {CLOSE_BUTTON_LABEL} diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/api_keys/components/api_keys_list.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/api_keys/components/api_keys_list.tsx index 016ab78b3abb4..10f1ca12a6130 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/api_keys/components/api_keys_list.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/views/api_keys/components/api_keys_list.tsx @@ -9,7 +9,13 @@ import React from 'react'; import { useActions, useValues } from 'kea'; -import { EuiBasicTable, EuiBasicTableColumn, EuiCopy, EuiConfirmModal } from '@elastic/eui'; +import { + EuiBasicTable, + EuiBasicTableColumn, + EuiCopy, + EuiConfirmModal, + useGeneratedHtmlId, +} from '@elastic/eui'; import { DELETE_BUTTON_LABEL, CANCEL_BUTTON_LABEL } from '../../../../shared/constants'; import { HiddenText } from '../../../../shared/hidden_text'; @@ -32,16 +38,19 @@ export const ApiKeysList: React.FC = () => { const { deleteApiKey, onPaginate, stageTokenNameForDeletion, hideDeleteModal } = useActions(ApiKeysLogic); const { apiTokens, meta, dataLoading, deleteModalVisible } = useValues(ApiKeysLogic); + const modalTitleId = useGeneratedHtmlId(); const deleteModal = (

{API_KEYS_CONFIRM_DELETE_LABEL}