Skip to content

[EuiOutsideClickDetector] Migrate from class to function component #9462

Closed

Description

@weronikaolejniczak

EuiOutsideClickDetector detects clicks outside its child element and calls an onOutsideClick handler. Used extensively by popovers, combo boxes, and other dismissible overlays.

  • File: components/outside_click_detector/outside_click_detector.tsx
  • Class size: 117 lines
  • State: None (uses instance properties id, capturedDownIds)
  • Lifecycle: componentDidMount, componentWillUnmount

Migration notes:

Instance properties become useRef. Mount/unmount event listener registration maps to useEffect cleanup. No complex derived state.

Acceptance criteria:

  • Convert to function component with useRef and useEffect
  • Maintain identical click detection behavior (mousedown + mouseup tracking)
  • All existing tests pass
  • Verify popover/combo box dismiss behavior

Activity

  1. added
    help wanted
    low hanging fruit
    on Mar 12, 2026
  2. github-actions commented on Mar 12, 2026

    @github-actions

    👋 Thank you for your suggestion or request! While the EUI team agrees that it's valid, it's unlikely that we will prioritize this issue on our roadmap. We'll leave the issue open if you or anyone else in the community wants to implement it by contributing to EUI. If not, this issue will auto close in one year.

  3. Dmc0125 commented on May 18, 2026

    @Dmc0125
    Contributor

    Hi, I'd like to work on this if it's still available.

  4. weronikaolejniczak commented on May 18, 2026

    @weronikaolejniczak
    ContributorAuthor

    Hey @Dmc0125 it's available, go ahead!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedlow hanging fruit

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions