Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { EuiConfirmModal } from '@elastic/eui';
import { EuiConfirmModal, useGeneratedHtmlId } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import React from 'react';
import { deleteWatches } from '../lib/api';
Expand All @@ -20,6 +20,9 @@ export const DeleteWatchesModal = ({
}) => {
const { toasts } = useAppContext();
const numWatchesToDelete = watchesToDelete.length;

const modalTitleId = useGeneratedHtmlId({ prefix: 'deleteWatchModal' });

if (!numWatchesToDelete) {
return null;
}
Expand Down Expand Up @@ -83,6 +86,8 @@ export const DeleteWatchesModal = ({
}}
cancelButtonText={cancelButtonText}
confirmButtonText={confirmButtonText}
aria-labelledby={modalTitleId}
titleProps={{ id: modalTitleId }}
>
{confirmModalText}
</EuiConfirmModal>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
EuiSelect,
EuiSpacer,
EuiTitle,
useGeneratedHtmlId,
} from '@elastic/eui';

import { PAGINATION } from '../../../../../common/constants';
Expand Down Expand Up @@ -99,6 +100,9 @@ export const ExecutionHistoryPanel = () => {
? JSON.stringify(watchHistoryDetails.details, null, 2)
: '';

const watchHistoryDetailFlyoutId = useGeneratedHtmlId({ prefix: 'watchFlyout' });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it 100% works, but maybe we can set different values of prefix for watchHistoryDetailFlyoutId and watchHistoryErrorDetailsFlyoutTitleId ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, fixed!

const watchHistoryErrorDetailsFlyoutTitleId = useGeneratedHtmlId({ prefix: 'watchErrorFlyout' });

if (historyError) {
return (
<Fragment>
Expand Down Expand Up @@ -229,12 +233,12 @@ export const ExecutionHistoryPanel = () => {
<EuiFlyout
data-test-subj="watchHistoryErrorDetailFlyout"
onClose={() => setDetailWatchId(undefined)}
aria-labelledby="watchHistoryErrorDetailsFlyoutTitle"
aria-labelledby={watchHistoryErrorDetailsFlyoutTitleId}
maxWidth={600}
>
<EuiFlyoutHeader>
<EuiTitle size="s">
<h3 data-test-subj="title">
<h3 data-test-subj="title" id={watchHistoryErrorDetailsFlyoutTitleId}>
<FormattedMessage
id="xpack.watcher.sections.watchHistory.watchHistoryDetail.errorTitle"
defaultMessage="Execution details"
Expand Down Expand Up @@ -305,12 +309,12 @@ export const ExecutionHistoryPanel = () => {
<EuiFlyout
data-test-subj="watchHistoryDetailFlyout"
onClose={() => setDetailWatchId(undefined)}
aria-labelledby="watchHistoryDetailsFlyoutTitle"
aria-labelledby={watchHistoryDetailFlyoutId}
maxWidth={600}
>
<EuiFlyoutHeader>
<EuiTitle size="s">
<h3 data-test-subj="title">
<h3 data-test-subj="title" id={watchHistoryDetailFlyoutId}>
<FormattedMessage
id="xpack.watcher.sections.watchHistory.watchHistoryDetail.title"
defaultMessage="Executed on {date}"
Expand Down