[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
EuiModal
andEuiModalHeader
components, in addition to adjustments in the tests and styles moved based on the changed components.EuiModal Enhancements:
onClose
down to children that accept it.children
processing to enhance each child with theonClose
prop if applicable.EuiModalHeader Enhancements:
onClose
prop 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.tsx
ChildWithOnClose
type to ensure children acceptingonClose
are type-safe.React.Children.map
andReact.cloneElement
to injectonClose
prop into child components.EuiModalHeader
.Changes in
modal_header.tsx
EuiButtonIcon
with styles and localization viaEuiI18n
.onClose
prop to facilitate parent-driven close behavior.Detailed Changes
modal.tsx
onClose
will receive it automatically, making the component more flexible.modal_header.tsx
modal.tsx
andmodal_header.tsx
styles were affected only to match reallocated code.QA
Remove or strikethrough items that do not apply to your PR.
General checklist
@default
if default values are missing) and playground toggles