Skip to content

Allow passing an array of refs to useClickAway #1036

@matthova

Description

@matthova

Is your feature request related to a problem? Please describe.
For my use case I have a button that opens a modal. Once the modal is open, I want clicking away to close the modal, but if I click on the modal toggle button, I get two conflicting commands - from the modal useClickAway event and from the button's onClick event.

Describe the solution you'd like
If I could pass an array of refs then I could prevent the behavior described above by passing a ref for the modal as well as the button.

Describe alternatives you've considered
I had tried making the modal toggle button only fire when the modal is closed, however that still ran into a race-condition, even when setting the mouse events to ['mouseup', 'touchend']. Another alternate solution would be to use a setTimeout, however I'd prefer to not use that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions