Skip to content

Commit a7914bb

Browse files
committed
support: ignore visibility change on clicking specified targets
1 parent 6dd9f25 commit a7914bb

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/index.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ export default class Trigger extends React.Component {
7878
maskAnimation: PropTypes.string,
7979
stretch: PropTypes.string,
8080
alignPoint: PropTypes.bool, // Maybe we can support user pass position in the future
81+
ignoreVisibilityChangeClassName: PropTypes.string,
8182
};
8283

8384
static contextTypes = contextTypes;
@@ -105,6 +106,7 @@ export default class Trigger extends React.Component {
105106
action: [],
106107
showAction: [],
107108
hideAction: [],
109+
ignoreVisibilityChangeClassName: '',
108110
};
109111

110112
constructor(props) {
@@ -326,8 +328,16 @@ export default class Trigger extends React.Component {
326328
if (this.props.mask && !this.props.maskClosable) {
327329
return;
328330
}
329-
331+
const { ignoreVisibilityChangeClassName } = this.props;
330332
const target = event.target;
333+
if (
334+
ignoreVisibilityChangeClassName &&
335+
typeof target.className === 'string' &&
336+
target.className.split(' ').filter(className => className === ignoreVisibilityChangeClassName)
337+
.length > 0
338+
) {
339+
return;
340+
}
331341
const root = findDOMNode(this);
332342
if (!contains(root, target) && !this.hasPopupMouseDown) {
333343
this.close();

0 commit comments

Comments
 (0)