Skip to content

Commit

Permalink
fix: don't consume clicks when no onClick given (fix mansona#274)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobq committed Mar 11, 2022
1 parent 1c16c50 commit a5adc72
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions addon/components/notification-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,13 @@ export default class NotificationMessage extends Component {

@action
handleOnClick(event) {
event.preventDefault();
this.notification.onClick?.(this.notification);
// If a handler was provided then use it instead of the default handler,
// otherwise take no action to avoid breaking native functionality in
// things like <a href="...">link</a> and <details><summary>twisty</summary>lorem ipsum</details
if (typeof this.notification.onClick === 'function') {
event.preventDefault();
this.notification.onClick(this.notification);
}
}

@action
Expand Down

0 comments on commit a5adc72

Please sign in to comment.