Skip to content

Releases: ooade/react-click-away-listener

Add support for focus events

04 Feb 08:53
b7cb153
Compare
Choose a tag to compare

This is to ensure that the onClickAway handler is fired whenever we focus on another element outside of the ClickAway component.

Thanks to @rishabh-ink for sending a PR for this! 🎉

BREAKING CHANGE: Handled Clickaway on the Cloned element

07 Feb 23:09
Compare
Choose a tag to compare

In this version, we no longer create an element and listen to the click and touchdown events whenever it's being triggered from anywhere on the document body excluding the element created.

Now, the event listener is being attached to the children with cloneElement, and we ensured not to replace the children's ref, onClick event and onTouchEnd events while doing that.

Note: It will only break your existing app if you depend on the previous Clickaway component for styling or if you have other properties on the listener. But you if previously rendered it as a span and the only property added is onClickAway, you can upgrade to the new version.

Shoutout to @jblevins1991 for suggesting this flow.

Clickaway on the cloned element

27 Jan 08:55
Compare
Choose a tag to compare
Pre-release
v2.0.0-alpha.0

Exclude children from interface

React Portal support

23 Jan 13:25
97e9dc0
Compare
Choose a tag to compare

This version makes it possible to use Clickaway listener with React Portals! 🎉

Render Clickaway listener as a specified element

27 Aug 09:57
Compare
Choose a tag to compare

This allows users to pass an "as" property to the click away listener and have it rendered as such.

Thanks to @calebdeji for this! 🎉

Use other props passed to the Click Away Component

10 Jun 09:50
Compare
Choose a tag to compare

Just a few updates:

  • Props were previously discarded when passed to the Click Away component but we've made it possible to treat the Click Away component as any regular div element. By doing that, it makes it possible to style or use it in any way you want without being gated to target the div from a parent element.
  • Fixed our ESlint issue.
  • Made sure to add a dependency array in our useEffect.

S/O to @Alphy11 for this release 🎉

Pass event to onClickAway callback

08 May 17:56
Compare
Choose a tag to compare

Passing the event in the callback ensures that you could make use of the event as you could do on every event handlers.

It makes it possible to do stuff like event.preventDefault() and all.

Thanks to @Naismith for bringing it up and implementing! 🎉

The one with custom mouse events and touch events

25 Jan 11:29
Compare
Choose a tag to compare

Yeah, it's live. We now support:

  • mouse events(click, mousedown, mouseup) and
  • touch events(touchup, touchdown).

Breaking change as we switched from using mouseDown to click as the default mouse event.