Merge pull request #920 from Bilb/fix-event-propagation-link-message

fix event propogation on links in messages
pull/933/head
Audric Ackermann 5 years ago committed by GitHub
commit 649cc5721d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -67,7 +67,7 @@ export class Linkify extends React.Component<Props> {
!HAS_AT.test(url) !HAS_AT.test(url)
) { ) {
results.push( results.push(
<a key={count++} href={url}> <a key={count++} href={url} onClick={this.handleClick}>
{originalText} {originalText}
</a> </a>
); );
@ -85,4 +85,10 @@ export class Linkify extends React.Component<Props> {
return results; return results;
} }
// disable click on <a> elements so clicking a message containing a link doesn't
// select the message.The link will still be opened in the browser.
public handleClick = (e: any) => {
e.stopPropagation();
};
} }

Loading…
Cancel
Save