Skip to content

Commit

Permalink
Fixed #1248 - onClose of GrowlMessage is also allowing onClick to fire
Browse files Browse the repository at this point in the history
  • Loading branch information
cagataycivici committed Mar 12, 2020
1 parent 0eb550b commit 8394afb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/components/growl/Growl.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import {GrowlMessage} from './GrowlMessage';
import DomHandler from '../utils/DomHandler';
import { CSSTransition, TransitionGroup } from 'react-transition-group';
import {CSSTransition, TransitionGroup} from 'react-transition-group';

var messageIdx = 0;

Expand Down
11 changes: 4 additions & 7 deletions src/components/growl/GrowlMessage.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import classNames from 'classnames';
import DomHandler from '../utils/DomHandler';

export class GrowlMessage extends Component {

Expand Down Expand Up @@ -37,22 +38,18 @@ export class GrowlMessage extends Component {
}
}

onClose(event) {
onClose() {
if (this.timeout) {
clearTimeout(this.timeout);
}

if (this.props.onClose) {
this.props.onClose(this.props.message);
}

if (event) {
event.preventDefault();
}
}

onClick() {
if (this.props.onClick) {
onClick(event) {
if (this.props.onClick && !(DomHandler.hasClass(event.target, 'p-growl-icon-close') || DomHandler.hasClass(event.target, 'p-growl-icon-close-icon'))) {
this.props.onClick(this.props.message);
}
}
Expand Down

0 comments on commit 8394afb

Please sign in to comment.