[EuiModal] Source order adjusted to annouce modal title before close #8233
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR introduces a workaround to solve the issue #7222, the following updates to the
EuiModalandEuiModalHeadercomponents, in addition to adjustments in the tests and styles moved based on the changed components.EuiModal Enhancements:
onClosedown to children that accept it.childrenprocessing to enhance each child with theonCloseprop if applicable.EuiModalHeader Enhancements:
onCloseprop to support closing the modal directly from the header.EuiButtonIcon) with proper accessibility (aria-label), now this close button is under the title, so it'll be annouce after.Changes in
modal.tsxChildWithOnClosetype to ensure children acceptingonCloseare type-safe.React.Children.mapandReact.cloneElementto injectonCloseprop into child components.EuiModalHeader.Changes in
modal_header.tsxEuiButtonIconwith styles and localization viaEuiI18n.onCloseprop to facilitate parent-driven close behavior.Detailed Changes
modal.tsxonClosewill receive it automatically, making the component more flexible.modal_header.tsxmodal.tsxandmodal_header.tsxstyles were affected only to match reallocated code.QA
Remove or strikethrough items that do not apply to your PR.
General checklist
@defaultif default values are missing) and playground toggles