diff --git a/src/components/growl/Growl.js b/src/components/growl/Growl.js index 86021d9950..ff01a15a10 100644 --- a/src/components/growl/Growl.js +++ b/src/components/growl/Growl.js @@ -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; diff --git a/src/components/growl/GrowlMessage.js b/src/components/growl/GrowlMessage.js index 0a74351c99..738ab58272 100644 --- a/src/components/growl/GrowlMessage.js +++ b/src/components/growl/GrowlMessage.js @@ -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 { @@ -37,7 +38,7 @@ export class GrowlMessage extends Component { } } - onClose(event) { + onClose() { if (this.timeout) { clearTimeout(this.timeout); } @@ -45,14 +46,10 @@ export class GrowlMessage extends Component { 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); } }