Skip to content

Commit

Permalink
fix: [Search:AppSearch:Engines:Documents page]Customize document sear…
Browse files Browse the repository at this point in the history
…ch modal dialog missing title from announcement (#202452)

Closes: #202427

## Description
Dialog modal visible title should be announced for the users, especially
using assistive technology to know what dialog modal, flyout opened.

## Changes made:

1. aria-labelledby={modalTitleId} attribute was added for mentioned
EuiModal

## Screen
<img width="1135" alt="Screenshot 2024-12-02 at 14 43 16"
src="https://github.com/user-attachments/assets/ce319c22-1ae9-49e1-99e1-7670e5d97993">
  • Loading branch information
alexwizp authored Dec 2, 2024
1 parent 93eedff commit 6b7d647
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
EuiModalFooter,
EuiModalHeader,
EuiModalHeaderTitle,
useGeneratedHtmlId,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';

Expand All @@ -44,6 +45,7 @@ export const CustomizationModal: React.FC<Props> = ({
sortFields,
}) => {
const { engine } = useValues(EngineLogic);
const modalTitleId = useGeneratedHtmlId();

const [selectedFilterFields, setSelectedFilterFields] = useState(
filterFields.map(fieldNameToComboBoxOption)
Expand All @@ -69,9 +71,9 @@ export const CustomizationModal: React.FC<Props> = ({
);

return (
<EuiModal onClose={onClose}>
<EuiModal onClose={onClose} aria-labelledby={modalTitleId}>
<EuiModalHeader>
<EuiModalHeaderTitle>
<EuiModalHeaderTitle id={modalTitleId}>
{i18n.translate(
'xpack.enterpriseSearch.appSearch.documents.search.customizationModal.title',
{
Expand Down Expand Up @@ -132,8 +134,11 @@ export const CustomizationModal: React.FC<Props> = ({
</EuiForm>
</EuiModalBody>
<EuiModalFooter>
<EuiButtonEmpty onClick={onClose}>{CANCEL_BUTTON_LABEL}</EuiButtonEmpty>
<EuiButtonEmpty data-test-subj="enterpriseSearchCustomizationModalButton" onClick={onClose}>
{CANCEL_BUTTON_LABEL}
</EuiButtonEmpty>
<EuiButton
data-test-subj="enterpriseSearchCustomizationModalButton"
fill
onClick={() => {
onSave({
Expand Down

0 comments on commit 6b7d647

Please sign in to comment.