Skip to content

[EuiOverlayMask] Remove onClick in favor of EuiFocusTrap combo #6016

@thompsongl

Description

@thompsongl

EuiOverlayMask <-- we've had issues in the past with click events on our overlay mask that Greg had to fix, and I'm a little worried about this potentially reintroducing bugs.

Willing to hear arguments against, but I think that EuiOverlayMask should no longer accept an onClick prop. The intention was to give an easy on-outside-click hook, but this is now inconsistent with our other approaches to outside click behavior, which have largely been standardized.

If it's necessary to unblock your React 17 PR, we can add the isCapture prop or prioritize the breaking change to remove onClick.

The suggestion would then be to use EuiFocusTrap in conjunction with EuiOverlayMask as we do in several components (e.g., EuiFlyout and EuiCodeBlock):

<EuiOverlayMask>
  <EuiFocusTrap onClickOutside={onClick} />
</EuiOverlayMask>

Originally posted by @thompsongl in #5940 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions