Skip to content

[EuiModal] Adjust the source order to announce EuiTitle before Close button #7222

@1Copenut

Description

@1Copenut

Describe the problem

@kyrspl && @cee-chen are making a dismiss (close) button to EuiCallout in #7156. They proposed moving the heading (title) before the dismiss button in the source order so screen reader users could hear the message heading before deciding to dismiss the callout. I seconded this approach and suggested we should update EuiModal to have this same source order.

Proposed solution

! EuiModal lines 85-109
! https://github.com/elastic/eui/blob/main/src/components/modal/modal.tsx#L85C9-L109C15

<div
  css={cssStyles}
  className={classes}
  onKeyDown={onKeyDown}
  tabIndex={0}
  style={newStyle}
  {...rest}
>
  <EuiI18n
    token="euiModal.closeModal"
    default="Closes this modal window"
  >
! Potentially add a prop to ignore this Close button
! Could be something like `hasHeader` that renders the button inside `EuiHeader`
    {(closeModal: string) => (
      <EuiButtonIcon
        iconType="cross"
        onClick={onClose}
        css={cssCloseIconStyles}
        className="euiModal__closeIcon"
        color="text"
        aria-label={closeModal}
      />
    )}
  </EuiI18n>
  {children}
</div>

WCAG or Vendor Guidance (optional)

Screenshots or Trace Logs

Screen Shot 2023-09-25 at 12 38 46 PM

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions