Fix preview card player getting embedded when clicking on the external link button (#29457)

This commit is contained in:
Claire 2024-02-29 14:54:02 +01:00 committed by GitHub
parent 6675bf574a
commit f24c62a5c8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -92,6 +92,10 @@ export default class Card extends PureComponent {
this.setState({ embedded: true });
};
handleExternalLinkClick = (e) => {
e.stopPropagation();
};
setRef = c => {
this.node = c;
};
@ -201,7 +205,7 @@ export default class Card extends PureComponent {
<div className='status-card__actions' onClick={this.handleEmbedClick} role='none'>
<div>
<button type='button' onClick={this.handleEmbedClick}><Icon id='play' icon={PlayArrowIcon} /></button>
<a href={card.get('url')} target='_blank' rel='noopener noreferrer'><Icon id='external-link' icon={OpenInNewIcon} /></a>
<a href={card.get('url')} onClick={this.handleExternalLinkClick} target='_blank' rel='noopener noreferrer'><Icon id='external-link' icon={OpenInNewIcon} /></a>
</div>
</div>
) : spoilerButton}