Skip to content

BREAKING CHANGE: Handled Clickaway on the Cloned element

Compare
Choose a tag to compare
@ooade ooade released this 07 Feb 23:09
· 54 commits to main since this release

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.