MCPcopy Create free account
hub / github.com/Lobos/react-ui / getClickAwayEvent

Method getClickAwayEvent

src/mixins/ClickAway.js:33–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31 }
32
33 getClickAwayEvent () {
34 let fn = this._clickAwayEvent;
35 if (!fn) {
36 fn = (event) => {
37 let el = this.clickAwayTarget || ReactDOM.findDOMNode(this);
38
39 // Check if the target is inside the current component
40 if (event.target !== el && !isDescendant(el, event.target)) {
41 if (this.onClickAway) {
42 this.onClickAway();
43 }
44 }
45 }
46 this._clickAwayEvent = fn;
47 }
48 return fn;
49 }
50};

Callers 2

bindClickAwayMethod · 0.80
unbindClickAwayMethod · 0.80

Calls 1

isDescendantFunction · 0.90

Tested by

no test coverage detected